mardi 1 janvier 2019

why does it not contain my append list? im trying to continue adding more items to the list while looping but when it the loop continues it vanishes

im creating a program to collect a students information (School purposes) but when i try to add new variables into my list it does not contain it (i did not close my loop) i need help

i have tried looking for sources in the internet that can help me and watched tons of videos in yt but still haven't answered my problem

count=1
loop=2
while count<loop:
    start = input ("Welcome student \n[1]login [2] register [3} Exit\n")
    stud_num =[]
    stud_course=[]
    stud_level=[]
    stud_name=[]
    stud_Add=[]
    stud_bday=[]
    stud_fname=[]
    stud_mname=[]
    if start== '1':
        stud_numb = int (input ("Hello what is your student No. "))
        if stud_numb in stud_num:
            print("you are registered")
        else:
            print("Your Student number is not registered please register")

    elif start == '2':
        num =int (input("Enter your Student number: "))
        stud_num.append(num)
        course= input("Enter your course: ")
        stud_course.append(course)
        level=int(input("Enter Year Level: "))
        stud_level.append(level)
        name=input("Enter Student name: ")
        stud_name.append(name)
        add=input("Enter Student Address: ")
        stud_Add.append(add)
        bday=int(input("Enter Birthdate: "))
        stud_bday.append(bday)
        fname=input("Enter student Father's name: ")
        stud_fname.append(fname)
        mname=input("Enter Student's Mother name: ")
        stud_mname.append(mname)
        print (stud_num,stud_course,stud_level,stud_name,stud_Add,stud_bday,stud_fname,stud_mname)

    elif start=='3':
        print("Thank you for using the program")
        break
    else:
        print("Invalid choice try again")

im expecting that when they type there student no. it will show that they have already registered

Aucun commentaire:

Enregistrer un commentaire