doodlebug9276 doodlebug9276
  • 07-01-2021
  • Computers and Technology
contestada

Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space. Example output for userNum

Respuesta :

Cytokine
Cytokine Cytokine
  • 07-01-2021

userNum = int(input("Enter a number: "))

while userNum > 1:

   print(userNum, end=" ")

   userNum /= 2

I wrote my code in python 3.8. I think this is what you want but I'm not too sure. I'll change the code if you need me to.

Answer Link

Otras preguntas

Ryan is experimenting with core materials for an electromagnet. He slides different core materials through a coil of current-carrying wire. Short the core mater
During a microsleep, you are likely to:
Solve the problem in the picture please
A will states that 9/10 of an estate is to be divided among relatives. Of the remaining​ estate, 1/4 goes to the American Cancer Society. What fraction of the e
At 10 am, a building casts a shadow that is 98 feet long. At the same time, a 5 feet tall man casts a shadow that is 4 feet long. Find the height of the build
A major component of gasoline is octane c8h18 . when octane is burned in air, it chemically reacts with oxygen gas o2 to produce carbon dioxide co2 and water h2
Which best describes the legislative setbacks Franklin Roosevelt encountered during his first two terms? A. Supreme Court rejection of the Social Security Act
Studies show that approximately 72 hours of video are uploaded to __________ every minute.
Select the answer that best completes this sentence: Juan Carlos __________ (decir) que va a llover. help please
which prophet and beliefs were tied to Israelites