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]
2 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]2 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
Which of the following groups would an animal with an exoskeleton, segmented body, and jointed appendages belong to???
Annette [7]
All arthropods have exoskeletons, like insects, spiders and crustaceans.
7 0
3 years ago
Read 2 more answers
The web lab consists of which elements. Select all that apply. Group of answer choices Files Inspector Tool Preview Hints Work S
djverab [1.8K]

Answer:

Inspector Tool

Preview

Work Space

Instructions

Explanation:

Web Lab is a function that incorporates HTML in web development. It has functions such as Workspace where the developer writes the body of the website. Preview helps the developer take a look at the final product of what he is creating. Instructions panel provides a list of the different types of html packages that the developer can chose from.

All of these options help the developer produce a website that is up to standard.

8 0
2 years ago
So I try to login into my origin account and this popped up.(photo). But everytime I try to type in something I’m unable to clic
Oduvanchick [21]
You have to restart your computer or maybe use another internet browser to access the website your trying to reach
7 0
3 years ago
Why not to use settimeout in angular.
barxatty [35]

Answer:

start with what you know

Explanation:

you can learn alot

4 0
2 years ago
If you have downloaded this book's source code from the companion Web site, you will find a file named text.txt in the Chapter 1
Lubov Fominskaja [6]

Answer:

Explanation:

The following python code loops through each line within a file called text.txt and counts all the words, then it divides this count by the number of sentences in the text file. Finally, output the average number of words per sentence.

f = open("text.txt", "r")

all_words = 0

sentences = 0

for x in f:

   list = x.split(' ')

   all_words += len(list)

   sentences += 1

average = all_words / sentences

print("There are an average of " + str(average.__round__()) + " words in each sentence.")

6 0
3 years ago
Other questions:
  • How is the EF​ computed? A. ES​ + Activity time B. LF minusActivity time C. ​Min{LS of all immediate following​ activities} D. ​
    11·1 answer
  • How do you know if your phone has a virus?
    13·1 answer
  • Which are characteristics of an effective solution? Choose all that apply. solves the problem in anticipated ways each time resu
    5·1 answer
  • The numeric keys on the keyboard are sometimes called the ten keypad. true false
    9·2 answers
  • A call center is a _______.<br><br> JIT<br><br> CMA<br><br> CIC<br><br> SFA
    8·1 answer
  • Is the following statement TRUE or FALSE?
    9·1 answer
  • 01110100 01101000 01101001 01110011 00100000 01110011 01110101 01100011 01101011 01110011 00100000 01100010 01100001 01101100 01
    12·2 answers
  • The best way to safeguard your document is to save it
    11·1 answer
  • User defined blocks of code can be created in
    13·1 answer
  • A for construct is a loop construct that processes a specified list of objects. As a result, it is executed as long as there are
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!