Feb-17-2021, 07:01 AM
Unable to run the below code.
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
# 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()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
