Oct-16-2020, 05:23 PM
This code cannot succeed for several reasons. First
Here is a more viable code
int(test_1)
does not transform test_1 into an integer. For this you would need test_1 = int(test_1)
. It means that the code is currently comparing strings. Second, the global variables intro_1_complete
and time_limit_exists
will not be set by the function random_questions()
because in this function, the variables with that names are local variables.Here is a more viable code
elif time_limit_ask[0] in ('r', 'R'): def random_questions(): while True: test_1 = int(input("Enter first number ") test_2 = int(input("Enter second number ") if test_1 <= test_2: return random_questions() intro_1_complete = True time_limit_exists = True