如何将start函数中的返回值origina_code,调入进sys函数中呢?
最后这样调用会将start函数执行两次,有时还会执行错误。
def start_system():
print("Please input your student number: \n")
input("Your student number:\n")
print("Please input your code:\n")
original_code = int(input("Your code:"))
print("Welcome come to student system")
print("---------------Student System---------------")
print(" 1.更改信息 2.更改账号" + "\n"
" 3.更改密码 4.删除账号" + "\n"
" 5.添加选课 6.退出系统" + "\n"
)
print(original_code)
return original_code
def sys_choice(operation_a, original_code):
if operation_a == 1:
input("Please input your old information:")
input("Input your new information:")
print("Mission success!")
elif operation_a == 2:
print("You have not access to achieve this operation!")
elif operation_a == 3:
original_code1 = int(input("Please input your original code:"))
if original_code1 == original_code:
new_code1 = int(input("Input your new code:"))
new_code2 = int(input("Make sure your new code:"))
if new_code2 == new_code1:
print("Operation is successful !")
else:
print("Error !, your input is different !")
else:
print("input is error !")
elif operation_a == 4:
print("Do you delete your number?")
choice4 = input("Please input your choice:")
if choice4 == 'y':
print("OK")
else:
print("Error !")
elif operation_a == 5:
print("choose your course:")
elif operation_a == 6:
choice6 = input("Are you sure log out the student system ?")
if choice6 == 'y' or 'yes':
print("Exit the success !")
elif choice6 == 'n' or 'no':
print("Cancel out !")
else:
print("Your input is error. Please input your choice again.")
'''如何让start返回code进入到sys中'''
start_system()
print("----------------\n")
operation_a = int(input("Make your choice:"))
sys_choice(operation_a, original_code=start_system())