3

Could someone please help me to understand why the program doesn't output 'Well done!' after I input 1? Thank you.

while True:
    o=input("Enter 1:")
    if o==1:
        break
print("Well done!")

1 Answers1

4

It looks like you're using python3.x.

On python3.x, input always returns an instance of str, so o will never equal the 1 since you're comparing different types (str and int).

mgilson
  • 300,191
  • 65
  • 633
  • 696