Feb-17-2021, 07:01 AM
Unable to run the below code.
Get error:
Traceback (most recent call last):
File "prog.py", line 21, in <module>
File "prog.py", line 13, in get_input1
EOFError: EOF when reading a line
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# your code goes here def get_input(): my_var = str ( input ( 'Enter "a" or "b": ' )) if my_var = = "a" or my_var = = "b" : print ( 'got input:' , my_var) return my_var else : print ( 'You didn\'t type "a" or "b". Try again.' ) return get_input() def get_input1(): my_var = input ( 'Enter "a" or "b": ' ) if my_var ! = "a" and my_var ! = "b" : print ( 'You didn\'t type "a" or "b". Try again.' ) return get_input1() else : return my_var print ( 'got input:' , get_input1()) #get_input() |
Traceback (most recent call last):
File "prog.py", line 21, in <module>
File "prog.py", line 13, in get_input1
EOFError: EOF when reading a line