Compare commits
	
		
			24 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a4493e6248 | |||
| ff96ee96dd | |||
| 69b3234c15 | |||
| 70e3c4e9f3 | |||
| 
						 | 
					858284cfd7 | ||
| 
						 | 
					9af58e79de | ||
| 
						 | 
					222154c92a | ||
| 
						 | 
					4101373e00 | ||
| 
						 | 
					0089ea0255 | ||
| 
						 | 
					a504c0d558 | ||
| 
						 | 
					3a3f034d8b | ||
| 
						 | 
					f5538e7d51 | ||
| 
						 | 
					00b27dd241 | ||
| 
						 | 
					56ebf103b0 | ||
| 
						 | 
					d78128178d | ||
| 
						 | 
					a8eb324a0f | ||
| 
						 | 
					e912fd4388 | ||
| 
						 | 
					e01832f8ee | ||
| 
						 | 
					0f1346416a | ||
| 
						 | 
					e09523649c | ||
| 
						 | 
					7590f3f177 | ||
| 
						 | 
					ea3ebd0a40 | ||
| 
						 | 
					
						
						
							
						
						4d317aa11a
	
				 | 
					
					
						||
| 
						 | 
					
						
						
							
						
						491ee5da05
	
				 | 
					
					
						
@@ -1,4 +1,4 @@
 | 
			
		||||
# calculmental_python
 | 
			
		||||
# calcpymental
 | 
			
		||||
 | 
			
		||||
Faites travailler vos neurones. Petit jeu de calcul mental simple programmé en python inspiré de mon premier programme réalisé à l'époque en Basic sur Amstrad CPC 6128
 | 
			
		||||
 | 
			
		||||
@@ -9,10 +9,10 @@ Ce script est développé sous Python 3 et doit fonctionner certainement sous Py
 | 
			
		||||
```
 | 
			
		||||
# Si ce n'est déjà fait !!
 | 
			
		||||
sudo apt-get install python3
 | 
			
		||||
git clone https://git.weblib.re/svnet/calculmental_python.git
 | 
			
		||||
git clone https://git.vermeulen.pro/PYTHON/calcpymental
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
cd calculmental_python
 | 
			
		||||
cd calcpymental
 | 
			
		||||
./calcul.py
 | 
			
		||||
```
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										107
									
								
								calcul.py
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								calcul.py
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
			
		||||
"""
 | 
			
		||||
Created on Wed Jun 27 18:50:20 2018
 | 
			
		||||
v0.3
 | 
			
		||||
@author: svnet
 | 
			
		||||
@author: @samuelvermeulen.pro
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import random
 | 
			
		||||
@@ -13,8 +13,13 @@ import time
 | 
			
		||||
 | 
			
		||||
os.system('clear') # On nettoye l'écran
 | 
			
		||||
score = 0
 | 
			
		||||
while 1:
 | 
			
		||||
    print("Votre Score est de ", score, " Points\n") # Affichage du score
 | 
			
		||||
tour = 1
 | 
			
		||||
 | 
			
		||||
ntour = input("nombre de tours ? ")
 | 
			
		||||
os.system('clear')
 | 
			
		||||
 | 
			
		||||
while tour <= int(ntour):
 | 
			
		||||
    print("Tour :", tour, "/", ntour) # Affichage tours
 | 
			
		||||
    # Tirage au sort des nombres et des opérandes
 | 
			
		||||
    a = random.randint(1,1000)
 | 
			
		||||
    b = random.randint(1,1000)
 | 
			
		||||
@@ -23,70 +28,94 @@ while 1:
 | 
			
		||||
        
 | 
			
		||||
    # On pose l'opération
 | 
			
		||||
    if op == 1:
 | 
			
		||||
        print("Combien font ", a, " + ", b, " = ")
 | 
			
		||||
        print("Combien font ", a, " + ", b, " = ", end = " ")
 | 
			
		||||
        resultat = input()
 | 
			
		||||
        if resultat == "q": #Quitter
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
            print(u"Au revoir et à Bientôt !!")
 | 
			
		||||
            break
 | 
			
		||||
        if int(resultat) == (a+b):
 | 
			
		||||
            print(u"Exact !!\n")
 | 
			
		||||
            score +=1 # Gagne 1 point
 | 
			
		||||
        try:
 | 
			
		||||
            if int(resultat) == (a+b):
 | 
			
		||||
                print(u"Exact !!\n")
 | 
			
		||||
                score +=1 # Gagne 1 point
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
            else:
 | 
			
		||||
                print(u"Faux !!\nLe Résultat était : ", (a+b), "\n")
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            print("C'est des maths et non pas de la littérature !!")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        else:
 | 
			
		||||
            print(u"Faux !!\nLe Résultat était : ", (a+b), "\n")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        
 | 
			
		||||
            
 | 
			
		||||
    if op == 2:
 | 
			
		||||
        print("Combien font ", a, " - ", b, " = ")
 | 
			
		||||
        print("Combien font ", a, " - ", b, " = ", end = " ")
 | 
			
		||||
        resultat = input()
 | 
			
		||||
        if resultat == "q": #Quitter
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
            print(u"Au revoir et à Bientôt !!")
 | 
			
		||||
            break
 | 
			
		||||
        if int(resultat) == (a-b):
 | 
			
		||||
            print(u"Exact !!\n")
 | 
			
		||||
            score +=1 # Gagne 1 point
 | 
			
		||||
        try:
 | 
			
		||||
            if int(resultat) == (a-b):
 | 
			
		||||
                print(u"Exact !!\n")
 | 
			
		||||
                score +=1 # Gagne 1 point
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
            else:
 | 
			
		||||
                print(u"Faux !!\nLe Résultat était : ", (a-b), "\n")
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            print("C'est des maths et non pas de la littérature !!")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        else:
 | 
			
		||||
            print(u"Faux !!\nLe Résultat était : ", (a-b), "\n")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        
 | 
			
		||||
            
 | 
			
		||||
    if op == 3:
 | 
			
		||||
        print("Combien font ", a, " X ", b, " = ")
 | 
			
		||||
        print("Combien font ", a, " X ", b, " = ", end = " ")
 | 
			
		||||
        resultat = input()
 | 
			
		||||
        if resultat == "q": #Quitter
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
            print(u"Au revoir et à Bientôt !!")
 | 
			
		||||
            break
 | 
			
		||||
        if int(resultat) == (a*b):
 | 
			
		||||
            print(u"Exact !!\n")
 | 
			
		||||
            score +=1 # Gagne 1 point
 | 
			
		||||
        try:
 | 
			
		||||
            if int(resultat) == (a*b):
 | 
			
		||||
                print(u"Exact !!\n")
 | 
			
		||||
                score +=1 # Gagne 1 point
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
            else:
 | 
			
		||||
                print(u"Faux !!\nLe Résultat était : ", (a*b), "\n")
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            print("C'est des maths et non pas de la littérature !!")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        else:
 | 
			
		||||
            print(u"Faux !!\nLe Résultat était : ", (a*b), "\n")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        
 | 
			
		||||
            
 | 
			
		||||
    if op == 4:
 | 
			
		||||
        print("Combien font ", a, " / ", b, " = (donnez l'entier)")
 | 
			
		||||
        print("Combien font ", a, " ÷ ", b, " = (donnez l'entier)", end = " ")
 | 
			
		||||
        resultat = input()
 | 
			
		||||
        if resultat == "q": #Quitter
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
            print(u"Au revoir et à Bientôt !!")
 | 
			
		||||
            break
 | 
			
		||||
        if int(resultat) == int(a/b):
 | 
			
		||||
            print(u"Exact !!\n")
 | 
			
		||||
            score +=1 # Gagne 1 point
 | 
			
		||||
        try:
 | 
			
		||||
            if int(resultat) == int(a/b):
 | 
			
		||||
                print(u"Exact !!\n")
 | 
			
		||||
                score +=1 # Gagne 1 point
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')
 | 
			
		||||
            else:
 | 
			
		||||
                print(u"Faux !!\nLe Résultat était : ", (a/b), "\n")
 | 
			
		||||
                time.sleep(2)
 | 
			
		||||
                os.system('clear')   
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            print("C'est des maths et non pas de la littérature !!")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')
 | 
			
		||||
        else:
 | 
			
		||||
            print(u"Faux !!\nLe Résultat était : ", (a/b), "\n")
 | 
			
		||||
            time.sleep(2)
 | 
			
		||||
            os.system('clear')   
 | 
			
		||||
            
 | 
			
		||||
            
 | 
			
		||||
    tour += 1 #Incrément tour
 | 
			
		||||
    
 | 
			
		||||
print("Partie terminée, votre note est de", score, "/", ntour) # Fin de Partie
 | 
			
		||||
input("\n\rTouche ENTRÉE pour quitter")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user