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
Ket [755]
3 years ago
14

g Write a program using integers usernum and x as input, and output usernum divided by x four times. For example, if the input i

s: 2000 2 where user_num = 2000 and x = 2, then the output must be: 1000 500 250 125 Note: all the values must be printed on the same line. Also, recall that in Python 3, integer division discards fractions. Ex: 6 // 4 is 1 (the 0.5 is discarded).
Computers and Technology
1 answer:
Tresset [83]3 years ago
4 0

Answer:

The python program to this question as follows:

Program:

usernum= 2000  #define variable usernum and assign value

x=2   #define variable x and assign value

result = ''  #define variable result

for i in range(4):  #loop for calculate value

   usernum =usernum//x  #divide value

   result += (' '+str(usernum))   #collect value

print(result) #print value

Output:

1000 500 250 125

Explanation:

In the above python program code firstly, two integer variable is defined that is "usernum and x" in which variable usernum holds a value that is "2000" and variable x holds a value that is "2", and a string variable result has defined, that store the calculated values.

  • In the next step, a for loop is declare that runs four times, in which the usernum variable divides its value by variable x and stores all the values in string variable result.
  • In the last print, function is used to print result variable value.
You might be interested in
In which type of network will a problem with one computer crash the network?
3241004551 [841]

It is easy to troubleshoot problems, Nodes can be added without disrupting the network, The malfunction of one workstation doesn't crash the network.

7 0
3 years ago
Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total number of inches. Note: The
jeka94

I'll pick up your question from here:

<em>Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total number of inches. Note: There are 12 inches in a foot. </em>

<em>Sample output with inputs: 5 8 </em>

<em>Total inches: 68</em>

<em />

Answer:

The program is as follows:

def print_total_inches(num_feet,num_inches):

     print("Total Inches: "+str(12 * num_feet + num_inches))

print_total_inches(5,8)

inches = int(input("Inches: "))

feet = int(input("Feet: "))

print_total_inches(feet,inches)

Explanation:

<em>This line defines the function along with the two parameters</em>

def print_total_inches(num_feet,num_inches):

<em>This line calculates and prints the equivalent number of inches</em>

     print("Total Inches: "+str(12 * num_feet + num_inches))

The main starts here:

<em>This line tests with the original arguments from the question</em>

print_total_inches(5,8)

<em>The next two lines prompts user for input (inches and feet)</em>

inches = int(input("Inches: "))

feet = int(input("Feet: "))

<em>This line prints the equivalent number of inches depending on the user input</em>

print_total_inches(feet,inches)

6 0
4 years ago
Need help plzz now it's hard ​
nalin [4]

Answer:

tost makinasıyla mı çektin amk bide siz zenginsizniz

Explanation:

5 0
3 years ago
In cryptocurrency, a block is only considered valid if it has a.
melomori [17]

Answer: Token

Explanation: The token gives proof that it is yours.

3 0
3 years ago
Award documentation is typically required to be prepared and submitted within how long after the end of a project period:_____.
Stella [2.4K]

Award documentation is typically required to be prepared and submitted within how long after the end of a project period of 90 days.

What does Award includes?

  • Awards to international organizations and government institutions, whether or whether they are covered by SNAP, must include annual expenditure information.
  • The report shall be submitted for each budget period, if necessary on an annual basis, no later than 90 days following the end of the calendar quarter in which the budget period concluded.
  • The report must include information on any allowed extensions to the budgetary period. If more regular reporting is necessary, both the frequency and the deadline shall be stated in the NoA.

Learn more about the Post-Award Monitoring and Reporting with the help of the given link:

brainly.com/question/15415195

#SPJ4

5 0
2 years ago
Other questions:
  • A user has a PC with RAID configuration and reports slow computer performance. A technician uses the manufacture’s diagnostic so
    12·1 answer
  • Apakah maksud input dan output ?<br>​
    12·1 answer
  • Osha requires employers pay for most required personal protective equipment including
    11·1 answer
  • Which term describes the degree to which a network can continue to function despite one or more of its processes or components b
    14·1 answer
  • Question 19 :Rachel, a database administrator, has created a database for her website. It contains pictures of vacations that pe
    13·1 answer
  • Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user en
    6·1 answer
  • When the city of chicago buys ipads™ for its restaurant inspectors to use during their visits, the purchase from apple would be
    13·1 answer
  • The elements in a long array of integers are roughly sorted in decreasing order. No more than 5 percent of the elements are out
    12·1 answer
  • sometimes people who have been playing gta for a while are annoying, i was playing gta this weekend and was trying to escape, bu
    8·2 answers
  • How can ICT be a tool in connecting all stakeholders in your community?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!