Apr-29-2020, 03:39 PM
(This post was last modified: Apr-29-2020, 03:40 PM by deanhystad.)
There are multiple ways to solve this problem. Perhaps the simplest is convert "solution" to a string instead of converting user_answer to an int.
If you need the answer to be an integer you can catch the exception
If you need the answer to be an integer you can catch the exception
try: correct_answer = solution == int(user_answer) except ValueError: correct_anser = False if correct_anser: # do correct answer stuff else: # do incorrect answer stuff