import yxy_login
from add_stu import add_stu
import check_stu
from delete_stu import del_stu
from revise_stu import revise_stu
作業二:寫一個登陸注冊
1.登陸
2.注冊
3.退出
====================
2
輸入賬號: aaa
輸入密碼:123456
提示注冊成功!
====================
1.登陸
2.注冊
3.退出
====================
1
賬號:aaa
密碼:123
密碼錯誤
賬號:bbb
賬號不存在
def main():
user_name = yxy_login.login_menu()
if not user_name:
print('退出系統!')
else:
# 編輯主界面循環
while True:
print('+' * 60)
print('+' + '歡迎來到非常非常簡易版的學生管理系統^_^'.center(40, ' ') + '+')
print('+' + '1.添加學生信息'.center(52, ' ') + '+')
print('+' + '2.查詢學生信息'.center(52, ' ') + '+')
print('+' + '3.刪除學生信息'.center(52, ' ') + '+')
print('+' + '4.修改學生信息'.center(52, ' ') + '+')
print('+'+'5.退出'.center(56, ' ')+'+')
print('+' * 60)
try:
step1 = int(input('請輸入您想進行的操作:'))
except TypeError:
print('請輸入正確的數字!')
continue
if step1 == 5:
break
# 編輯添加學生的循環界面
elif step1 == 1:
while True:
add_stu(user_name)
print('1.繼續添加')
print('2.返回上一步')
try:
step2 = int(input('請輸入您想進行的操作: '))
except TypeError:
print('請輸入正確的數字!')
continue
if step2 == 2:
break
elif step2 == 1:
continue
else:
print('請輸入正確的數字!')
# 編輯查詢學生的界面
elif step1 == 2:
while True:
print('1.查詢指定學生信息')
print('\n2.查詢所有學生信息')
print('\n3.查詢指定學生平均分')
print('\n4.返回上一步')
try:
step3 = int(input('請輸入您想進行的操作: '))
except TypeError:
print('請輸入正確的數字!')
continue
if step3 == 4:
break
elif step3 == 1:
check_stu.search_stu(user_name)
elif step3 == 2:
check_stu.check_all(user_name)
elif step3 == 3:
check_stu.avg_score(user_name)
else:
print('請輸入正確的數字!')
# 編輯刪除學生的界面
elif step1 == 3:
del_stu(user_name)
# 編輯修改學生的界面
elif step1 == 4:
revise_stu(user_name)
else:
print('請輸入正確的數字!')
if __name__ == '__main__':
main()