(autiste) j'ai codé un truc pour faire du calcul mental
- 1
j'ai remarqué que rankyourbrain et sa section calcul mental n'existent plus
j'ai donc décidé de créer mon propre outil en python
vous choisissez le type d'opération (addition ou multiplication)
ensuite vous rentrez le niveau de difficulté que vous voulez (1, 2 ou 3)
import random
x = input("quel type d'operation?\n")
x = str(x)
value = input("level 1 2 3?:\n")
value = int(value)
print("niveau: ",value)
if value == 1 and x == "addition":
nb=1
score = 0
while nb<=20:
aleat1 = random.randint(1, 9)
aleat2 = random.randint(1, 9)
print("calcul :",aleat1, "+",aleat2)
reponse = int(input("réponse = "))
nb = nb + 1
result = (aleat1 + aleat2)
if reponse==result :
score = score + 1
elif reponse!=result :
score = score + 0
print("correction:", result)
print("score:", score, "/20")
if score>=16 :
print("Bravo")
if score<10 :
print("nul")
if score<16 and score>=10:
print("bien")
if value == 2 and x == "addition":
nb=1
score = 0
while nb<=20:
aleat1 = random.randint(1, 999)
aleat2 = random.randint(1, 999)
print("calcul :",aleat1, "+",aleat2)
reponse = int(input("réponse = "))
nb = nb + 1
result = (aleat1 + aleat2)
if reponse==result :
score = score + 1
elif reponse!=result :
score = score + 0
print("correction:", result)
print("score:", score, "/20")
if score>=16 :
print("Bravo")
if score<10 :
print("nul")
if score<16 and score>=10:
print("bien")
if value == 3 and x == "addition":
nb=1
score = 0
while nb<=20:
aleat1 = random.randint(1, 99999)
aleat2 = random.randint(1, 99999)
print("calcul :",aleat1, "+",aleat2)
reponse = int(input("réponse = "))
nb = nb + 1
result = (aleat1 + aleat2)
if reponse==result :
score = score + 1
elif reponse!=result :
score = score + 0
print("correction:", result)
print("score:", score, "/20")
if score>=16 :
print("Bravo")
if score<10 :
print("nul")
if score<16 and score>=10:
print("bien")
if value == 1 and x == "multiplication":
nb=1
score = 0
while nb<=20:
aleat1 = random.randint(1, 9)
aleat2 = random.randint(1, 9)
print("calcul :",aleat1, "x",aleat2)
reponse = int(input("réponse = "))
nb = nb + 1
result = (aleat1 * aleat2)
if reponse==result :
score = score + 1
elif reponse!=result :
score = score + 0
print("correction:", result)
print("score:", score, "/20")
if score>=16 :
print("Bravo")
if score<10 :
print("nul")
if score<16 and score>=10:
print("bien")
if value == 2 and x == "multiplication":
nb=1
score = 0
while nb<=20:
aleat1 = random.randint(1, 99)
aleat2 = random.randint(1, 99)
print("calcul :",aleat1, "x",aleat2)
reponse = int(input("réponse = "))
nb = nb + 1
result = (aleat1 * aleat2)
if reponse==result :
score = score + 1
elif reponse!=result :
score = score + 0
print("correction:", result)
print("score:", score, "/20")
if score>=16 :
print("Bravo")
if score<10 :
print("nul")
if score<16 and score>=10:
print("bien")
if value == 3 and x == "multiplication":
nb=1
score = 0
while nb<=20:
aleat1 = random.randint(1, 999)
aleat2 = random.randint(1, 999)
print("calcul :",aleat1, "x",aleat2)
reponse = int(input("réponse = "))
nb = nb + 1
result = (aleat1 * aleat2)
if reponse==result :
score = score + 1
elif reponse!=result :
score = score + 0
print("correction:", result)
print("score:", score, "/20")
if score>=16 :
print("Bravo")
if score<10 :
print("nul")
if score<16 and score>=10:
print("bien")
quel type d'operation?
Traceback (most recent call last):
File "/tmp/main.py", line 2, in <module>
import user_code
File "/tmp/user_code.py", line 3, in <module>
x = input("quel type d'operation?\n")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line
[Execution complete with exit code 1]
Le 14 janvier 2024 à 06:53:44 :
quel type d'operation?
Traceback (most recent call last):
File "/tmp/main.py", line 2, in <module>
import user_code
File "/tmp/user_code.py", line 3, in <module>
x = input("quel type d'operation?\n")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line[Execution complete with exit code 1]
Le 14 janvier 2024 à 06:59:26 :
Je sais pas coder donc je ne sais même pas ce que l'erreur veut dire, j'ai juste tenter de compiler et exécuter
moi non plus je m'y connais pas
j'ai lu 2 ou 3 trucs, un tuto sur les conditions et les boucles
ça fonctionne sur mon pc en tt cas
je sais pas pourquoi toi ça le fait pas
j'aimerais comprendre
- 1
Données du topic
- Auteur
- danieIHernandez
- Date de création
- 14 janvier 2024 à 06:47:51
- Nb. messages archivés
- 11
- Nb. messages JVC
- 11