students={}
print("""Öğrenci numarası sorgulamak için 1'e,
Öğrenci kaydetmek için 2 ye basınız""")
def system():
choose=int(input("\nişlem: "))
if choose == 2:
studentNumber = int(input("\nÖğrenci No: "))
studentName = input("\nÖğrenci Adı: ")
studentSurname = input("\nÖğrenci Soyadı: ")
studentPhone = int(input("\nÖğrenci Telefonu: "))
students.update({
studentNumber:{
"Adı:" : studentName,
"Soyadı:":studentSurname,
"Telefonu:":studentPhone
}
})
elif choose == 1:
check=int(input("Öğrencinin numarası:"))
if check in studentNumber:
print(students[check])
else:
print("Bir şeyleri yanlış girdin!")
while True:
system()
Bu kodu çalıştırdığımda local variable 'studentNumber' referenced before assignment
hatasını alıyorum.
Anladığım kadarıyla değişken tanımlamadan kullandığım için bu hatayı veriyor ama koddaki hatayı göremedim.Yardımcı olabilir misiniz?