Ben C.
asked 05/16/18How does Python compare string and int?
EX: 100 > "2" returns what?
More
1 Expert Answer
Inactive Tutor answered 01/05/21
Tutor
New to Wyzant
Hi, Ben. Comparing two different data types, in this case an integer and a string results in a TypeError.
The number 2 that you put in double quotation marks("") is actually a string hence the error.
Make sure to compare numbers with other numbers, not strings that have numbers in it!
Hope this helps!
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Inactive Tutor
magic of python12/04/20