Things I want to achieve:
1. Login
2. Reset Password
3. Quit
What would you like to do? 2
Student ID: afrank
Error! Please enter your Student ID Number.
Student ID: 39211111x
Error! Please enter your Student ID Number.
Student ID: 39211111111
Error! Student ID Not Found
Student ID: 392111111
User Name: afrank
What year were you admitted? 2018
New Password: abc456
Confirm New Password: abc456
Password Changed!
1. Login
2. Reset Password
3. Quit
What would you like to do? 3
Codes:
def reset_password():
isUser = False
changed = False
sid = input('Student ID: ')
try:
sid = int(sid)
import math
digits = int(math.log10(sid)) + 1
if digits != 9:
print('Error: Student ID Not Found')
reset_password()
else:
pass
except:
print('Error: Please enter your Student ID Number.')
reset_password()
def options_menu():
print('1. Login'+'\n'+'2. Reset Password'+'\n'+'3. Quit'+'\n'+'What would you like to do?')
option = int(input())
if option == 1:
hello_login()
elif option == 2:
reset_password()
elif option == 3:
pass
options_menu()
Outputs:
1. Login
2. Reset Password
3. Quit
What would you like to do? 2
Student ID: afrank
Error! Please enter your Student ID Number.
Student ID: 39211111x
Error! Please enter your Student ID Number.
Student ID: 39211111111
Error! Student ID Not Found
Student ID: 392111111
User Name: afrank
What year were you admitted? 2018
New Password: abc456
Confirm New Password: abc456
Password Changed!
1. Login
2. Reset Password
3. Quit
What would you like to do? 3
Error! Please enter your Student ID Number
Error! Please enter your Student ID Number
Error! Please enter your Student ID Number
Process finished with exit code 0
I'm new to Python. I noticed the error repeated 3 times, which part did I do wrong in the recursive function?