Hej there, I want to use a while loop in a program (version used: Python 3.3.0), and I expect it to loop unless the user enters an integer or a floating-point number instead of a string.
print("TIME TRACKING") hours_worked = input("How many hours did you work today? ") while hours_worked != str() or int(): hours_worked = input("Can't understand you. Please enter a number! ") print("you worked " + str(hours_worked) + " hours today.") When I run the program, it keeps looping even if the condition is met. How do I need to modify the program on the 3rd line so that it stops looping when the user enters a floating-point number or an integer? Thank you! Raf _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor