1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Serggg [28]
3 years ago
9

(Reverse number) Write a program that prompts the user to enter a four-digit inte- ger and displays the number in reverse order.

Here is a sample run:
Computers and Technology
1 answer:
prohojiy [21]3 years ago
6 0

Answer:

The program in Python is as follows:

num = int(input("4 digit number: "))

numstr = str(num)

if(len(numstr)!=4):

    print("Number must be 4 digits")

else:

    numstr = numstr[::-1]

    num = int(numstr)

    print(num)

Explanation:

This prompts user for input

num = int(input("4 digit number: "))

This converts the input number to string

numstr = str(num)

This checks if number of digits is or not 4

if(len(numstr)!=4):

If not, the following message is printed

    print("Number must be 4 digits")

else:

If digits is 4,

This reverses the string

    numstr = numstr[::-1]

This converts the reversed string to integer

    num = int(numstr)

This prints the reversed number

    print(num)

You might be interested in
Determine the number of cache sets (S), tag bits (t), set index bits (s), and block offset bits (b) for a 1024-byte 4-way set as
Cerrena [4.2K]

Answer:

The answer is The Cache Sets (S) = 32, Tag bits (t)=24, Set index bits(s) = 5 and Block offset bits (b) = 3

Explanation:

Solution

Given Data:

Physical address = 32 bit (memory address)

Cache size = 1024 bytes

Block size = 8 bytes

Now

It is a 4 way set associative mapping, so the set size becomes 4 blocks.

Thus

Number of blocks = cache size/block size

=1024/8

=128

The number of blocks = 128

=2^7

The number of sets = No of blocks/set size

=128/4

= 32

Hence the number of sets = 32

←Block ←number→

Tag → Set number→Block offset

←32 bit→

Now, =

The block offset = Log₂ (block size)

=Log₂⁸ = Log₂^2^3 =3

Then

Set number pc nothing but set index number

Set number = Log₂ (sets) = log₂³² =5

The remaining bits are tag bits.

Thus

Tag bits = Memory -Address Bits- (Block offset bits + set number bits)

= 32 - (3+5)

=32-8

=24

So,

Tag bits = 24

Therefore

The Cache Sets = 32

Tag bits =24

Set index bits = 5

Block offset bits = 3

Note: ←32 bits→

Tag 24 → Set index  5→Block offset 3

7 0
2 years ago
In which wireless configuration type do nodes communicate directly with each other, rather than with an access point?
amid [387]

Ad-hoc

Explanation:

In which wireless configuration type do nodes communicate directly with each other, rather than with an access point? In an AD-HOC network, all nodes communicate and transmit directly to each other.

6 0
3 years ago
PYTHON
Korvikt [17]

Answer:

import random

print("Hello! I have a random number from 1 to 100! It is your job to try and guess it!")

number = random.randint(1,101)

guess = int(input("start to guess: "))

num_guesses = 1

while guess != number:

   if guess > number:

       print("lower")

       guess = int(input("try again: "))

       num_guesses +=1

   elif guess < number:

       print ("higher")

       guess = int(input("start to guess: "))

       num_guesses +=1

print("congrats it took you", num_guesses, "tries")

Explanation:

6 0
2 years ago
PLEASE HELPPPPP ASAP, 50 POINT'S + BRAINLIEST
vagabundo [1.1K]

Answer:

1. Cybercrimes are online crimes that cause loss of money some examples are: Identity fraud, Cyber bribery, Debit/credit card fr/ud, and Email fr/ud.  

2. In medical offices devices linked to CT scans are able to be h/cked, there is r/nsomw/re that uses their devices. Since medic/l computers are always linked to the internet. it makes it easier for them to be h/cked. They make an employee click on an e-mail carrying m/lw/re, then the cybercrimin/ls encrypt p/tient data then dem/nd p/yment for its decryption.

3. This is a personal question but if you have ever been sc/mmed or witnessed someone being sc/mmed or almost got  sc/mmed it might apply to this question

6 0
3 years ago
Which phrase is the best definition of social media?
Nataly [62]

A. Media designed for sharing information and promoting social

interactions

8 0
2 years ago
Other questions:
  • What types of data are commonly entered into a cell ?
    7·2 answers
  • All languages from the second generation on must be translated into machine language for the computer to be able process the inp
    8·1 answer
  • What is the purpose of lookup tables in spreadsheet software
    13·2 answers
  • By applying styles formats are being applied ?
    14·2 answers
  • What do you click to create a new presentation in Normal view
    14·1 answer
  • Determine the “answer” to the formula according to the spreadsheet below:<br><br> =A3 + B4 + D2.
    15·1 answer
  • Given an array arr of type int , along withtwo int variables i and j , write some code thatswaps the values of arr[i] and arr[j]
    6·1 answer
  • How to understand amortized analysis potential?
    12·1 answer
  • How to get the home button on your screen?
    13·1 answer
  • suppose a malloc implementation returns 8-byte aligned addresses and uses an explicit free list where the next and previous poin
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!