vendredi 1 janvier 2021

is there a way to make the code return to the first line?

def input_nilai():

nilai = input(f"Masukan nilai huruf matkul {list_matkul[a]} (A-F): ").upper()

if nilai == "A":
    nilai = 4
    list_nilai.append(nilai)
elif nilai == "B":
    nilai = 3
    list_nilai.append(nilai)
elif nilai == "C":
    nilai = 2
    list_nilai.append(nilai)
elif nilai == "D":
    nilai = 1
    list_nilai.append(nilai)
elif nilai == "E" or "F":
    nilai = 0
    list_nilai.append(nilai)
else:
    input_nilai()

hey, so i'm a first semester student at one of the institutes in Indonesia, i want to make a code so everytime the user input letter besides A, B, C, D, E and F, the code will not proceed and return to the first question, but i tried this code and it doesn't work, can somebody help me solve this? thanks

Aucun commentaire:

Enregistrer un commentaire