Informatique

Question

mettre cet algorithmes en version python
je n'arrive pas à faire cela j'espère que vous pourriez m'aider
merci d'avance :)
mettre cet algorithmes en version python je n'arrive pas à faire cela j'espère que vous pourriez m'aider merci d'avance :) ​

1 Réponse

  • Explications:

    from random import randint

    n = 0

    max = 20

    for i in range(0, max):

    a = randint(1, 10)

    b = randint(1, 10)

    rep = input(f"Calculez {a} x {b}")

    if rep == a*b:

    n += 1

    print(f"Gagné ! Vous avez {n} points")

    else:

    print(f"Caramba, c'est raté, vous avez {n} points")

    print(f"Nombre d'essais : {max}, Nombre de points : {n} / {max}"

    Voilà !