IDNLearn.com offers a comprehensive solution for finding accurate answers quickly. Whether it's a simple query or a complex problem, our experts have the answers you need.

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

Sagot :

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.