-2

What is the cause of unintentional infinite loops in my code in Python 2.7 but in Python 3.5 gives me error message?

Python 3.5 gives TypeError: unorderable types: str() > int(), How should I resolve it?

Program

condition = '2'

while condition > 5:

    print 'test'
Finwood
  • 3,829
  • 1
  • 19
  • 36

1 Answers1

3

You're trying to compare '2' (a string) to 5 (an int). You should declare without quotes:

condition = 2
Max Feng
  • 352
  • 3
  • 10