-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCours 9.py
More file actions
39 lines (29 loc) · 939 Bytes
/
Copy pathCours 9.py
File metadata and controls
39 lines (29 loc) · 939 Bytes
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
def fct (**kid):
print("Son nom de famille est " + kid["nomdefamille"])
fct(prénom = "Michel", nomdefamille = "Berger")
def fct2(*nombres):
print("Le deuxième nombre est {}".format(nombres[1]))
fct2(1, 2)
def max2(a, b):
return max(a, b)
print(max2(2, 3))
def fct3():
liste = []
for i in range(5):
liste.append(int(input("Entrez le {}e nombre > ".format(i + 1))))
print("La liste crée est {}".format(liste))
print("Le maximum de la liste est {} et le minimum est {} !".format(min(liste), max(liste)))
fct3()
def fct4():
try:
n = int(input("Entrez un nombre > "))
if n < 1:
raise Exception()
if (n % 2 == 0):
print("{} est pair !".format(n))
else:
print("{} est impair !".format(n))
except:
print("Entrez un nombre valide !")
fct4()
fct4()