Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: cp1252 -*-
- #MOd by punkeel ;)
- # Imports
- import random
- # Fonctions
- def menu():
- fois='-1'
- while(fois=='-1'):
- try:
- fois = int(raw_input("Combien de calculs souhaitez vous faire ? >>"))
- except:
- print 'La chose que vous venez d\'entrer ne semble pas etre un nombre'
- fois='-1'
- calcul(fois)
- def calcul(fois):
- ensemble = 0
- while ensemble < fois:
- a = random.randint(0,10)
- b = random.randint(0,10)
- signe = random.randint(1,3)
- resultat_2='-1'
- if signe == 1:
- resultat_1 = a + b
- print a, "+", b, "="
- elif signe == 2:
- resultat_1 = a - b
- print a, "-", b, "="
- else:
- resultat_1 = a * b
- print a, "*", b, "="
- while(resultat_2=='-1'):
- try:
- resultat_2 = int(raw_input("Resultat >>"))
- except:
- print 'Le resultat que vous venez d\'entrer ne semble pas etre un nombre'
- resultat_2='-1'
- if resultat_1 == resultat_2:
- print "Bravo"
- else:
- print "Dommage"
- ensemble = ensemble + 1
- # Main
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement