Import Work from 2012/2013
This commit is contained in:
42
2nd/MPS/Programmation/prog/PFC.py
Normal file
42
2nd/MPS/Programmation/prog/PFC.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from random import *
|
||||
|
||||
print('Bonjour bienvenu dans le jeu: Pierre Feuille Ciseaux')
|
||||
print("Vous allez affronter l'ordinateur sur ce célèbre jeu")
|
||||
print("Vous communiquerez à l'ordinateur votre choix de la manière suivante:")
|
||||
print(" -> 1 correspondra à pierre")
|
||||
print(" -> 2 correspondra à feuille")
|
||||
print(" -> 3 correspondra à ciseaux")
|
||||
print("Commençons")
|
||||
|
||||
print("Que choisissez vous?")
|
||||
choixUtili = input()
|
||||
choixUtili = int(choixUtili)
|
||||
|
||||
print("L'ordinateur fait son choix")
|
||||
choixOrdi = randint(1,3)
|
||||
|
||||
print("Vous avez choisit: " + str(choixUtili))
|
||||
print("L'ordinateur a choisit: " + str(choixOrdi))
|
||||
|
||||
print("Délibération")
|
||||
|
||||
if choixOrdi == choixUtili:
|
||||
print("Égalité!")
|
||||
|
||||
if choixUtili == 1:
|
||||
if choixOrdi == 2:
|
||||
print("L'ordinateur gagne")
|
||||
if choixOrdi == 3:
|
||||
print("Vous gagnez!")
|
||||
|
||||
if choixUtili == 2:
|
||||
if choixOrdi == 1:
|
||||
print("Vous gagnez!")
|
||||
if choixOrdi == 3:
|
||||
print("L'ordinateur gagne")
|
||||
|
||||
if choixUtili == 3:
|
||||
if choixOrdi == 1:
|
||||
print("Vous gagnez!")
|
||||
if choixOrdi == 2:
|
||||
print("L'ordinateur gagne")
|
||||
38
2nd/MPS/Programmation/prog/deviner_nbr.py
Normal file
38
2nd/MPS/Programmation/prog/deviner_nbr.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from random import *
|
||||
|
||||
print("Bonjour bienvenu dans le jeu: devinette d'un nombre")
|
||||
print("Je choisis un nombre entre 1 et 20 et")
|
||||
print("Vous avez 6 tentatives pour trouver le nombre que j'aurai choisi")
|
||||
|
||||
# L'ordinateur fait son choix
|
||||
choix = randint(1,20)
|
||||
|
||||
print("Quel est votre première tentative?")
|
||||
tentative = input()
|
||||
# On transforme le réponse en un entier
|
||||
tentative = int(tentative)
|
||||
|
||||
nbr_tentative = 1
|
||||
|
||||
while nbr_tentative <= 6:
|
||||
if tentative == choix:
|
||||
print("Bravo vous avez trouvé le bon chiffre")
|
||||
break
|
||||
|
||||
elif tentative > choix:
|
||||
print("Mon chiffre est plus petit")
|
||||
elif tentative < choix:
|
||||
print("Mon chiffre est plus grand")
|
||||
|
||||
nbr_tentative = nbr_tentative + 1
|
||||
# On redemande le choix de l'utilisateur
|
||||
print("Quel est votre nouvelle tentative?")
|
||||
tentative = input()
|
||||
# On transforme le réponse en un entier
|
||||
tentative = int(tentative)
|
||||
|
||||
if tentative != choix:
|
||||
print("Vous avez perdu")
|
||||
print("Mon chiffre était: ", choix)
|
||||
|
||||
|
||||
15
2nd/MPS/Programmation/prog/index.rst
Normal file
15
2nd/MPS/Programmation/prog/index.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
Notes sur prog
|
||||
##############
|
||||
|
||||
:date: 2013-07-01
|
||||
:modified: 2013-07-01
|
||||
:tags: MPS
|
||||
:category: 2nd
|
||||
:authors: Benjamin Bertrand
|
||||
:summary: Pas de résumé, note créée automatiquement parce que je ne l'avais pas bien fait...
|
||||
|
||||
|
||||
|
||||
`Lien vers deviner_nbr.py <deviner_nbr.py>`_
|
||||
|
||||
`Lien vers PFC.py <PFC.py>`_
|
||||
Reference in New Issue
Block a user