i need help with this problem. ask user to enter a number inside an infinite while loop, compare this number to let say 50 (less, greater or equal). but in order to exit this while loop user must enter "exit". i have the following code that is working according to requirement but i want 'exit' (if) statement to be written at the end. doing so definitely causes an error. please feel free for alternative ways.
while True:
x = input('please enter a number to compare or enter "exit" to exit the loop \n')
if x == "exit":
exit()
elif int(x) > 50:
print(x, 'is greater than 50')
elif int(x) < 50:
print(x, 'is less than 50')
else:
print('the number you entered is 50')