139k views
24 votes
Write a while loop that prints user_num divided by 2 until user_num is less than 1. The value of user_num changes inside of the loop. Sample output for the given program:

User Thandi
by
3.6k points

2 Answers

7 votes

Answer:

user_num = int(input())

while user_num>= 1:

print(user_num/2)

user_num /= 2

Step-by-step explanation:

Simplified it

User Berndinox
by
3.5k points
7 votes

user_num = 20

while user_num>= 1:

print(user_num,"divided by 2 =",user_num/2)

user_num /= 2

I wrote my code in python 3.8. I hope this helps.

User Lewin
by
3.3k points