Topic de danieIHernandez :

(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 https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png
vous choisissez le type d'opération (addition ou multiplication) https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png
ensuite vous rentrez le niveau de difficulté que vous voulez (1, 2 ou 3) https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png

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") 
    
si quelqu'un veut bien le tester ça serait sympa
autrement c'est pas grave
je sais que ça fonctionne, c'est ce qui compte https://image.noelshack.com/fichiers/2022/15/1/1649632974-hgjghjgjgghjhgghj.png

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]

ah c'est bizarre ça
https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png

Les autres, ça fonctionne chez vous? https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png
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 :hap:

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 :hap:

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 https://image.noelshack.com/fichiers/2024/02/7/1705212167-481818.png

je sais pas pourquoi toi ça le fait pas
j'aimerais comprendre https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png

Je t'apporte la réponse alors. Vu que je code pas je suis passé par un assembleur en ligne. Le premier pue la merde à voir, ça fonctionne sur un autre. :)

Le 14 janvier 2024 à 07:09:14 :
Je t'apporte la réponse alors. Vu que je code pas je suis passé par un assembleur en ligne. Le premier pue la merde à voir, ça fonctionne sur un autre. :)

ah okok c'est cool
merci https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png
et bonne journéee https://image.noelshack.com/fichiers/2024/01/5/1704455241-chatrigolo.png

Merci à toi, je me rends compte que j'ai pas mal perdu en calcul mental. Bonne initiative.
  • 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
En ligne sur JvArchive 328