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

Adam, Bella and Carl collect tokens in a game. Bella has 10 more taken than Adam. Carl has 8 more tokens Bella. Altogether they have 91 tokens. How many does A
Apply Pascal's law to a ketchup packet. Explain what will happen if you tear a small hole in one corner of a packet and then squeeze the packet.
Alcohol use can effect this organ and the kidneys
3. What is the greatest common factor of 6 and 16? *
7. What change, if any, should be made to sentence 9? A:Change hieroglyphics to Hieroglyphics B:Change papyrus to Papyrus C:Change Paper to paper D:Make no chan
-6[tex] - 6 + 3 \times 4 - 11[/tex]+3x4-11​
please help! thank u!
Describe the position of a minority group in a gunpowder empire.
a) Work out 16.3-4.97 + 8.6 (2) I b) Work out 2164.89 +7 (2)
From the list below, choose the items that are classified as a materials activity(You may select more than one answer. 1. Raw materials used 2. Raw materials