What I am trying to do
I have a simple function for string
input validation.
Code:
def get_string_input(prompt):
while True:
try:
value = str(input(prompt))
except ValueError:
time.sleep(0.3)
print("Incorrect command. Please try again")
continue
if type(value) != str:
time.sleep(0.3)
print("Incorrect command. Please try again")
continue
else:
break
return value
# Test
get_string_input('What is your name? ')
Problem:
When I run the program, I recieve the following error:
I can see that my indentation is correct, so why is it giving me an error?