scripts python
This commit is contained in:
		
							
								
								
									
										2
									
								
								sio1/sisr1/70-python/hello.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								sio1/sisr1/70-python/hello.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| #!/usr/bin/python3 | ||||
| print ("bonjour"); | ||||
							
								
								
									
										15
									
								
								sio1/sisr1/70-python/phrase.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								sio1/sisr1/70-python/phrase.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| #!/usr/bin/python3 | ||||
|  | ||||
| phrase = str(input("Entrez une phrase à analyser : ")); | ||||
| tabmots = phrase.split(' '); | ||||
| cptmots = {} | ||||
|  | ||||
| for mot in tabmots: | ||||
|     if mot not in cptmots: | ||||
|         cptmots[mot]=1 | ||||
|     else: | ||||
|         cptmots[mot] = cptmots[mot] + 1 | ||||
|  | ||||
| for mot in cptmots: | ||||
|     print(mot, ":", cptmots[mot]) | ||||
|  | ||||
							
								
								
									
										4
									
								
								sio1/sisr1/70-python/rayon.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										4
									
								
								sio1/sisr1/70-python/rayon.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| #!/usr/bin/python3 | ||||
| rayon=float(input("Entrez le rayon du cercle en cm : ")); | ||||
| perimetre=float(2*rayon*3.141592); | ||||
| print("le perimètre du cercle est :", perimetre, "cm"); | ||||
							
								
								
									
										38
									
								
								sio1/sisr1/70-python/tableau.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										38
									
								
								sio1/sisr1/70-python/tableau.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| #!/usr/bin/python3 | ||||
|  | ||||
| min=int(0); | ||||
| max=int(0); | ||||
| i=int(0); | ||||
| tableau=[]; | ||||
| moyenne=float(0); | ||||
|  | ||||
| nombre=int(input("Entrez un nombre entier : ")); | ||||
| min=nombre; | ||||
| if nombre>max: | ||||
|     max=nombre; | ||||
| tableau.append(nombre); | ||||
|  | ||||
|  | ||||
| for i in range(0,4): | ||||
|     nombre=int(input("Entrez un nombre entier : ")); | ||||
|  | ||||
|     if nombre<min: | ||||
|         min=nombre; | ||||
|  | ||||
|     if max<nombre: | ||||
|         max=nombre; | ||||
|  | ||||
|     tableau.append(nombre); | ||||
|  | ||||
| for i in range(0,5): | ||||
|     moyenne+=float(tableau[i]); | ||||
|  | ||||
| moyenne=float(moyenne/len(tableau)); | ||||
|  | ||||
| for i in range(0,5): | ||||
|     print(tableau[i]); | ||||
|  | ||||
| print("\nLe plus petit nombre est : ", min); | ||||
| print("Le nombre le plus grand est : ", max); | ||||
| print("La moyenne est de :", moyenne); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user