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
Leya [2.2K]
3 years ago
11

Write a program using integers userNum and x as input, and output userNum divided by x three times.

Computers and Technology
1 answer:
andrezito [222]3 years ago
7 0

Answer:

# The user is prompted to enter number as dividend

# The received number is assigned to userNum

userNum = int(input("Enter the number you want to divide: "))

# The user is prompted to enter number as divisor

# The divisor is assigned to x

x = int(input("Enter the number of times to divide: "))

# divideNumber function is defined to do the division

def divideNumber(userNum, x):

   # counter is declared to control the loop

   counter = 1

   # the while-loop loop 3 times

   # the division is done 3 times

   while counter <= 3:

       # integer division is done

       # truncating the remainder part

       userNum = userNum // x

       # the result of the division is printed

       print(userNum, end=" ")

       # the counter is incremented

       counter += 1

# the divideNumber function is called

# the received input is passed as parameter

# to the function

divideNumber(userNum, x)

# empty line is printed

print("\n")

Explanation:

The // operator in python works like the / operator in C. The // operator returns only the integer part of division operation. For instance 6 // 4 = 1. The fraction part is discarded.

You might be interested in
Write a Boolean expression that tests if the value stored in the variable num1 is equal to the value stored in the variable num2
Alenkinab [10]

Answer:

num1 = int(input("Enter value: "))

num2 = int(input("Enter value: "))

if num1 == num2:

   print("Equals.")

else:

   print("Unequal.")

Explanation:

6 0
2 years ago
If a firm is set to use open-source software with which no one in the IT department is familiar, what should it do? fire the IT
Aleonysh [2.5K]
The most efficient thing to do would be to provide training as firing or doing nothing halts productivity indefinitely while training eventually will finish
7 0
3 years ago
Read 2 more answers
Which contact field is used to control the name that would appear in the To field of an email message when a user is sending a m
ser-zykov [4K]

Answer:

Display as

Explanation:

Need the same question, but that's my guess, because display, means to show.

3 0
2 years ago
Read 2 more answers
Give state diagrams of DFAs that recognize the following languages.
k0ka [10]

Answer:

Following is attached the solution of each part step-by-step. I hope it will help you!

Explanation:

6 0
3 years ago
What would 128 kbps look like on a phone? i.e. 4g, 3g, 2g, etc
vovangra [49]
5g I think.............
8 0
3 years ago
Other questions:
  • A ____ is harmful computer code that spreads without your interaction, slipping from one network to another and replicating itse
    15·1 answer
  • One reason for using social media is to develop social and professional contacts. True or false?
    9·2 answers
  • Can someone help me to give this guy brainliest the button is not there
    8·1 answer
  • Which is an internet service?<br><br> Antivirus<br> Chat<br> Firewall<br> Router
    8·2 answers
  • A keyboard is a/an _____. interconnector port packet NAS
    7·1 answer
  • What is TLB for? Why TLB? Given the following number, what is theeffective memory access time?
    11·1 answer
  • Which terms means device that converts one voltage to another ?
    15·1 answer
  • Please help this is a coding assignment I need help! (use python)
    12·1 answer
  • Which best compares portrait and landscape orientations?
    7·1 answer
  • Which two features could be added to a game using an "if () then " block
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!