vendredi 20 mars 2020

Updating global variable after an If statement

The variable 'k' is not updating at the end of If statement ( unless I updating it inside If statement ). Which is the right way or the explanation?thx

lvl = 1
k = lvl * 10
while lvl <= 10:
    user = int(input(" "))
    if user == 5:
        lvl += 1
       'k = lvl * 10'
   print(lvl)
   print(k)

Aucun commentaire:

Enregistrer un commentaire