-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTravailpython.py
More file actions
200 lines (149 loc) · 3.95 KB
/
Travailpython.py
File metadata and controls
200 lines (149 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import sys
from math import *
from operator import truediv
from zipimport import alt_path_sep
"""def Hello(nom, age, AnneeNaissance):
if nom == "joe":
print("Hello joe, Welcome to the world")
print("Bonjour Joe, l'apostrophe, c'est cool !")
print('Bonjour Joe, comme diraient certains : "quelle belle journée" !')
print('Bonjour Joe, comme dirait l\'autre : "c\'est une belle journée"')
print(nom + " est né en " + str(AnneeNaissance))
else:
print("Hello World")
nom = sys.stdin.readline().strip()
age = int(sys.stdin.readline().strip())
AnneeNaissance = int(sys.stdin.readline().strip())
Hello(nom, age, AnneeNaissance)
def perimetrecercle(r):
return r * 2 * pi
print(perimetrecercle(5))
def vitesse(tmps, dist):
return (dist/tmps * 3.6)
print(vitesse(50, 40))
def longueurPisteCourse(r, l):
return perimetrecercle(r) + l*2
print(longueurPisteCourse(5, 5))
def vitesse2(r,l ,tmps):
return vitesse(tmps, longueurPisteCourse(r,l))
print(vitesse2(200, 900, 600))
def Coureurs(r, l):
lst = []
for compteur in range(0,5):
print("donner un temps", compteur)
lst.append(int(input()))
for i in range(0,(len(lst))):
lst[i] = vitesse2(r,l,lst[i])
return lst
def Coureurs2(r, l):
Coureurs = []
for compteur in range(0, 5):
print("donner un temps", compteur)
Coureurs.append(int(input()))
vitesses = []
for temps in lst:
vitesses.append(vitesse2(r,l,lst[i]))
r = int(input("rayon du terrain"))
l = int(input("longeur du terrain"))
print(Coureurs(r, l))
print("+-------------------------------------------------+")
print("+ CALCULATEUR +")
print("+-------------------------------------------------+")
def SaisirEntier():
a = int(input("Saisir un entier : "))
return a
def Calcul():
nb1 = SaisirEntier()
nb2 = SaisirEntier()
a = print(nb1, "+", nb2, "=", nb1 + nb2)
b = print(nb1, "-", nb2, "=", nb1 - nb2)
c = print(nb1,"x", nb2, "=", nb1 * nb2)
if nb2 != 0:
d = print(nb1, "/", nb2, "=", nb1 / nb2)
return a, b, c, d
else:
return a, b, c
Calcul()
def EstPair():
nb = int(input("Nombre d'entiers : "))
if nb%2 == 0:
return True
else:
return False
#print(EstPair())
def max(a, b):
if a > b:
return a
else:
return b
def ToutLesPairs(x):
if x % 2 == 0:
while x != 0:
return x - 2
else:
x = x - 1
while x != 0:
print(x)
return x - 2
#print(ToutLesPairs(5))
def factorielle(n):
a = 1
for i in range(0, n):
a = a * n
n = n - 1
return a
print(factorielle(5))
print(5 * 4 * 3 * 2)
def EstPremier(x):
if x % 2 == 0 or x % 3 == 0:
return False
else:
return True
print(EstPremier(11))
import random
def nb_aleatoire():
nb = random.randint(1, 100)
return nb
def Deviner(n, nd):
if nd > n:
print("nombre trop petit : ")
return False
elif nd < n:
print("nombre trop grand : ")
return False
else:
return True
def recuperer():
a = int(input("Saisir un nombre : "))
return a
def jouer():
nb_deviner = nb_aleatoire()
nb_coups = 0
result = False
while not result == True:
nb = recuperer()
Deviner(nb, nb_deviner)
nb_coups += 1
if nb == nb_deviner:
result = True
return result
print(jouer())"""
def triangle(x):
for i in range(1, x + 1):
print("#" * i)
triangle(5)
def pyramide(x):
for i in range(x, 0, -1):
print("#" * i)
print(pyramide(5))
"""def pyramide(x):
for i in range(0, x, 1):
print(" " * (x - i) + "#" * (i * 2 + 1))
x = int(input("quelle hauteur ?"))
pyramide(x)"""
def pyramide(x):
for i in range(x, 0, -1):
print(" " * (x - i) + "#" * (i * 2 - 1))
x = int(input("quelle hauteur ?"))
pyramide(x)
print('\n')