Answer:
def dividedByTwo(userNum):
out = []
num = userNum
while num > 1:
num = num//2
out.append(num)
try:
if out[-1]==1:
print(str(userNum) + ': ' + str(out))
else:
print("Program end never reached.")
except:
print("Program end never reached.")
userNum = int(input())
dividedByTwo(userNum)
Explanation:
We created a function called dividedByTwo that receives the user input, inside the function is a while loop that just allows numbers greater than one to avoid an infinite loop, this while loop will finish when the division reaches one; finally, an if statement checks if 1 was reached, otherwise, an error message will prompt.
The output of the testing in the image down below