Feb-06-2019, 10:02 PM
Im new to python
when i added and else statement to catch mistakes and have it return to the beginning it crashes but it works just fine without the else statement
def add():
name = str(input("What is the character name? "))
print("\nAre you sure your okay with", name, "? y/n ")
check = input().lower()
if check == "y":
a_char.write(name)
a_char.close()
if check == "n":
print("Thats okay please try again!")
add()
else:
print("Sorry I don't understand!")
add()
when i added and else statement to catch mistakes and have it return to the beginning it crashes but it works just fine without the else statement
def add():
name = str(input("What is the character name? "))
print("\nAre you sure your okay with", name, "? y/n ")
check = input().lower()
if check == "y":
a_char.write(name)
a_char.close()
if check == "n":
print("Thats okay please try again!")
add()
else:
print("Sorry I don't understand!")
add()