from random import*
erreurs = ['pierre','feuille','ciseaux']
def jeu(joueur):
joueur=joueur.lower()
#On ragarde si les information entrées par l'utilisateur sonr coérantes, sinn, on lui demande réésayer
E=0
for i in erreurs:
if i == joueur:
E=1
if E==0:
return '!! IL Y A UNE ERREURE DANS LA SAISIE, VEILLEZ REESAYER !!'
main= randint(1,3)
#la pierre correspond au 1, le 2 à la feuille et le 3 au ciseau
if main==1:
print('L ordinateur à joué la PIERRE')
if main==2:
print('L ordinateur à joué la FEUILLE')
if main==3:
print('L ordinateur à joué les CISEAUX')
#On compart nos résultat avec ceux de la bibliothèque
if main== 1 and joueur =="pierre" or main == 2 and joueur=="feuille" or main== 3 and joueur=="ciseau":
return "Match nul"
elif main ==1 and joueur =="feuille" or main ==2 and joueur =="ciseau" or main ==3 and joueur =="pierre":
return "Vous avez gagné ! "
else:
return "Vous avez perdu"
# on défini la fonction
print(jeu(str(input("Voulez vous jouer la pierre, la feuille ou le ciseau? "))))