0

Why is my program doesn't adding 1 to note?

note = 0 print("Exercice 1: trouvez la figure de style") print("aimable tyrannie") reponse_1=input() if reponse_1=="oxymore" : note + 1 else: note + 0 print("Exercice 2: trouvez la figure de style") print("l'astre de la nuit") reponse_2=input() if reponse_2=="périphrase" or "periphrase" : note + 1 else: note + 0 print(note, "/10")

21st Oct 2018, 2:37 PM
Alexis Durand
Alexis Durand - avatar
4 odpowiedzi
+ 3
You need to write: note += 1. If you only write +, Python will calculate the result but not save it anywhere.
21st Oct 2018, 2:41 PM
HonFu
HonFu - avatar
+ 2
Oh OK thank you
21st Oct 2018, 2:42 PM
Alexis Durand
Alexis Durand - avatar
+ 2
I think you can remove the else statements, they don't change the value of "note". And your statement with if and or looks wrong. it should be like: If var == "word1" or var == "word2"
21st Oct 2018, 3:49 PM
Paul
Paul - avatar
0
Ok thank you I would try it
21st Oct 2018, 4:50 PM
Alexis Durand
Alexis Durand - avatar