I've a little problem, I'm a python beginner and I don't understand one thing. I would like that when the player enters a result other than a number, a loop reminds him that he must enter a number and that if the result of a point voucher is added. My problem is that everything is good except the addition of points, in fact when I enter my 2 good results I stay at 0, I think it's because my points vary between 0 and 1 but I don't know how to solve the problem. If someone could help me ^^
def calcul(x, n):
global points
resultats = 0
while results == 0:
try:
resultats = int(input(f"[!] {x} + {n} = "))
return
except:
print("\n Oops ! Le nombre n'est pas valide. Ressaies... \n")
if resultats == x + n:
points += 1
calcul(5, 5)
calcul(5, 3)
print(f"\n {points}")
Aucun commentaire:
Enregistrer un commentaire