-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode
331 lines (330 loc) · 9.35 KB
/
Code
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
rep=True
taux_GBP=0.8759
taux_USD=1.0673
taux_CAD=1.4642
while True:
print(" ")
if rep:
print("Conversion de distances, poids, devises,")
print("temperature, vitesse, temps, volume, pression")
print("ou des valeurs numériques.")
rep=False
n=int(input("Choisir 1,2,3,4,5,6,7,8 ou 9 : "))
if n==1:
print(" ")
m=int(input("Choisir km → miles (1) ou miles → km (2). "))
if m==1:
o=float(input("Choisir la valeur en km : "))
miles=o/1.609
print(str(o),"km =",str(round(miles,2)),"mile(s).")
elif m==2:
o=float(input("Choisir la valeur en miles : "))
km=o*1.609
print(str(o),"miles =",str(round(km,2)),"km.")
elif n==2:
print(" ")
a=int(input("Choisir kg → lb (1) ou lb → kg (2). "))
if a==1:
b=float(input("Choisir la valeur en kg : "))
lb=b/2.20462
print(str(b),"kg =",str(round(lb,2)),"lb.")
elif a==2:
b=float(input("Choisir la valeur en lb : "))
kg=b*2.20462
print(str(b),"lb =",str(round(kg,2)),"kg.")
elif n==3:
print(" ")
print("Tu peux convertir les euros(EUR) en")
print("livres(lb), en dollars americains(USD)")
print("ou en dollars canadiens(CAD).")
d=int(input("Choisir 1, 2 ou 3. "))
if d==1:
c=int(input("Choisir EUR → GBP (1) ou GBP → EUR (2). "))
if c==1:
d=float(input("Choisir la valeur en EUR : "))
GBP=d*taux_GBP
print(str(d),"EUR =",str(round(GBP,2)),"GBP.")
elif c==2:
d=float(input("Choisir la valeur en GBP : "))
EUR=d/taux_GBP
print(str(d),"GBP =",str(round(EUR,2)),"EUR.")
if d==2:
c=int(input("Choisir EUR → USD (1) ou USD → EUR (2). "))
if c==1:
d=float(input("Choisir la valeur en EUR : "))
USD=d*taux_USD
print(str(d),"EUR =",str(round(USD,2)),"USD.")
elif c==2:
d=float(input("Choisir la valeur en USD : "))
EUR=d/taux_USD
print(str(d),"USD =",str(round(EUR,2)),"EUR.")
elif n==4:
print(" ")
c=int(input("Choisir °C → °F (1) ou °F → °C (2) : "))
if c==1:
v=int(input("Choisir la valeur en °C : "))
far=v*9/5+32
print(str(v),"°C =",str(round(far,2)),"°F.")
elif c==2:
v=int(input("Choisir la valeur en °F : "))
deg=v*9/5+32
print(str(v),"°F =",str(round(deg,2)),"°C.")
elif n==5:
print(" ")
print("Choisir m/s → km/h (1), km/h → m/s (2),")
c=int(input("km/h → mph (3) ou mph → km/h (4) : "))
if c==1:
v=int(input("Choisir la valeur en m/s : "))
kmh=v*3.6
print(str(v),"m/s =",str(round(kmh,2)),"km/h.")
elif c==2:
v=int(input("Choisir la valeur en km/h : "))
ms=v/3.6
print(str(v),"km/h =",str(round(ms,2)),"m/s.")
elif c==3:
v=int(input("Choisir la valeur en km/h : "))
mph=v/1.609
print(str(v),"km/h =",str(round(mph,2)),"mph.")
elif c==4:
v=int(input("Choisir la valeur en mph : "))
kmh=v*1.609
print(str(v),"mph =",str(round(kmh,2)),"km/h.")
elif n==6:
valeurs=["seconde(s)","minute(s)","heure(s)","jour(s)","semaine(s)","mois","année(s)","siècle(s)"]
print("Tu dois choisir la valeur de départ, qui")
print("peut être des sec, min, heu, jour,")
print("semaine, mois, années ou siècles.")
c=int(input("Choisir 1,2,3,4,5,6,7 ou 8 : "))
d=int(input("Choisir la valeur de conversion (1,2,3...) : "))
v=int(input("Combien de",valeurs[c],":"))
if d==c:
print("Les deux valeurs sont les mêmes !")
elif c==1:
if d==2:
r=c/60
elif d==3:
r=c/3600
elif d==4:
r=c/86400
elif d==5:
r=c/604800
elif d==6:
r=c/2592000
elif d==7:
r=c/31104000
elif d==8:
r=c/3110400000
elif c==2:
if d==1:
r=c*60
elif d==3:
r=c/60
elif d==4:
r=c/1440
elif d==5:
r=c/10080
elif d==6:
r=c/43200
elif d==7:
r=c/525600
elif d==8:
r=c/52560000
elif c==3:
if d==1:
r=c*3600
elif d==2:
r=c*60
elif d==4:
r=c/24
elif d==5:
r=c/168
elif d==6:
r=c/720
elif d==7:
r=c/8760
elif d==8:
r=c/876000
elif c==4:
if d==1:
r=c*86400
elif d==2:
r=c*1440
elif d==3:
r=c*24
elif d==5:
r=c/7
elif d==6:
r=c/30
elif d==7:
r=c/365
elif d==8:
r=c/36500
elif c==5:
if d==1:
r=c*604800
elif d==2:
r=c*10080
elif d==3:
r=c*168
elif d==4:
r=c*7
elif d==6:
r=c/30/7
elif d==7:
r=c/52.1429
elif d==8:
r=c/5214.29
elif c==6:
if d==1:
r=c*2592000
elif d==2:
r=c*43200
elif d==3:
r=c*720
elif d==4:
r=c*30
elif d==5:
r=c*4.29
elif d==7:
r=c/12
elif d==8:
r=c/1200
elif c==7:
if d==1:
r=c*3153600
elif d==2:
r=c*525600
elif d==3:
r=c*8760
elif d==4:
r=c*365
elif d==5:
r=c*52.1429
elif d==6:
r=c*12
elif d==8:
r=c/100
elif c==8:
if d==1:
r=c*3155760000
elif d==2:
r=c*52596000
elif d==3:
r=c*876600
elif d==4:
r=c*36525
elif d==5:
r=c*5218
elif d==6:
r=c*1200
elif d==7:
r=c*100
print(str(round(v,2)),valeurs[c],"=",str(round(r,2)),valeurs[d])
elif n==7:
print("Il y a m3 → L, m3 → gal ou L → gal.")
c=int(input("Choisir 1, 2 ou 3 :"))
if c==1:
d=int(input("Choisir m3 → L (1) ou L → m3 (2) : "))
if d==1:
v=int(input("Choisir la valeur en m3 : "))
l=v*1000
print(str(v),"m3 =",str(round(l)),"L.")
elif d==2:
v=int(input("Choisir la valeur en L : "))
met=v/1000
print(str(v),"L =",str(round(met)),"m3.")
elif c==2:
d=int(input("Choisir m3 → gal (1) ou gal → m3 (2) : "))
if d==1:
v=int(input("Choisir la valeur en m3 : "))
gal=v*264.2
print(str(v),"m3 =",str(round(gal)),"gal.")
elif d==2:
v=int(input("Choisir la valeur en gal : "))
met=v/2964.2
print(str(v),"gal =",str(round(met)),"m3.")
elif c==3:
d=int(input("Choisir m3 → L (1) ou L → m3 (2) : "))
if d==1:
v=int(input("Choisir la valeur en gal : "))
l=v*3.785
print(str(v),"gal =",str(round(l)),"L.")
elif d==2:
v=int(input("Choisir la valeur en L : "))
gal=v/3.785
print(str(v),"L =",str(round(gal)),"gal.")
elif n==8:
print("Il y a les conversion de Pa → bar, Pa → Psi,")
print("Pa → mmHg, bar → Psi, bar → mmHg ou Psi → mmHg.")
c=int(input("Choisir 1, 2, 3, 4, 5 ou 6 : "))
if c==1:
r=int(input("Choisr Pa → bar (1) ou bar → Pa (2) : "))
if r==1:
v=int(input("Choisir la valeur en Pa : "))
bar=v/100000
print(str(v),"Pa =",str(round(bar,2)),"bar.")
elif r==2:
v=int(input("Choisir la valeur en bar : "))
pa=v*100000
print(str(v),"bar =",str(round(pa,2)),"Pa.")
elif c==2:
r=int(input("Choisr Pa → Psi (1) ou Psi → Pa (2) : "))
if r==1:
v=int(input("Choisir la valeur en Pa : "))
psi=v/6895
print(str(v),"Pa =",str(round(psi,2)),"Psi.")
elif r==2:
v=int(input("Choisir la valeur en Psi : "))
pa=v*6895
print(str(v),"Psi =",str(round(pa,2)),"Pa.")
elif c==3:
r=int(input("Choisr Pa → mmHg (1) ou mmHg → Pa (2) : "))
if r==1:
v=int(input("Choisir la valeur en Pa : "))
mmhg=v/133.3
print(str(v),"Pa =",str(round(mmhg,2)),"mmHg.")
elif r==2:
v=int(input("Choisir la valeur en mmHg : "))
pa=v*133.3
print(str(v),"mmHg =",str(round(Pa,2)),"Pa.")
elif c==4:
r=int(input("Choisr Psi → bar (1) ou bar → Psi (2) : "))
if r==1:
v=int(input("Choisir la valeur en Psi : "))
bar=v/14.104
print(str(v),"Psi =",str(round(bar,2)),"bar.")
elif r==2:
v=int(input("Choisir la valeur en bar : "))
psi=v*14.104
print(str(v),"bar =",str(round(psi,2)),"Psi.")
elif c==5:
r=int(input("Choisr mmHg → bar (1) ou bar → mmHg (2) : "))
if r==1:
v=int(input("Choisir la valeur en bar : "))
mmhg=v/750.1
print(str(v),"bar =",str(round(mmhg,2)),"mmHg.")
elif r==2:
v=int(input("Choisir la valeur en mmHg : "))
bar=v*750.1
print(str(v),"mmHg =",str(round(bar,2)),"bar.")
elif c==6:
r=int(input("Choisr Psi → mmHg (1) ou mmHg → Psi (2) : "))
if r==1:
v=int(input("Choisir la valeur en Psi : "))
mmhg=v*51.715
print(str(v),"Psi =",str(round(mmhg,2)),"mmHg.")
elif r==2:
v=int(input("Choisir la valeur en mmHg : "))
psi=v/51.715
print(str(v),"mmHg =",str(round(psi,2)),"Psi.")
elif n==9:
print("Il y a dec → hex, dec → bin")
c=int(input("Choisir 1 ou 2 : "))
if c==1:
v=int(input("Choisir la valeur en dec : "))
hexa=hex(v)
print(str(v),"=",str(hexa))
elif c==2:
v=int(input("Choisir la valeur en dec : "))
bina=bin(v)
print(str(v),"=",str(bina))