我对编码很新,所以这个问题可能非常愚蠢和明显,但我应该在哪里放置我的循环,以便每次我在字典中添加新密钥时StuL都不会重置,因为每次我都有试图输入循环用户添加的密钥保持重置
import time
StuL = {"1317281" : "Name : Reese John ID :1317281 DoB : 12/11/95 Address
: 57 Fake Road Phone Number : 02087475632 Gender : Male Tutor Group : 10K
Email : JohnReese@HighSchool.com"}
UserName = input ("Enter Username: ")
PassWord = input ("Enter Password: ")
if UserName == "MrLeeman" and PassWord == "hunter2":
time.sleep(1)
print ("Login successful")
time.sleep(1)
ch=(input("Enter your choice\n1:View student details\n2:Add
Students\n3:Exit"))
if ch == "1":
time.sleep(1)
inp = input("Enter student's ID number")
if inp in StuL:
time.sleep(1)
print(StuL[inp])
elif ch == "2":
time.sleep(1)
edit=input("Enter the ID for the student you wish to add")
inf=input("Enter the information for the student in the following
order\nName,ID,DoB,Address,Phone number,Gender,Tutor
Group,Email")
StuL[edit] = inf
elif ch == "3":
break
else:
print("Invalid option")
else:
print ("Password did not match")