jeu_des_allumettes_advanced.py

Created by elodie-gamot

Created on March 07, 2022

703 Bytes


from math import *
from random import *

allumettes=[i for i in range(20)]
print("l"*len(allumettes))
print("L'IA enlève",3)
for i in range(3):
  allumettes.remove(allumettes[-1])
while len(allumettes)>1:
  sub=int(input("Choisir un nb entre 1 et 3:"))
  for i in range(sub):
    allumettes.remove(allumettes[-1])
  print("l"*len(allumettes))
  if len(allumettes)==1:
    print("Vous avez gagné")
  else:
    if sub==1:
      ia=3
    if sub==2:
      ia=2
    if sub==3:
      ia=1
    print("L'IA enlève",ia)
    for i in range(ia):
      allumettes.remove(allumettes[-1])
    print("l"*len(allumettes))
    if len(allumettes)==1:
      print("Vous avez perdu !")

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.