print("\nExercice 4\n") ## Question 4.1 # int -> bool def est_pair(n): return n%2 == 0 ## Question 4.2 # int -> bool def bissextile(année): return (année%4 == 0 and année%100 != 0) or année%400 == 0 ## Question 4.3 # int -> bool def année_normale(année): return (année%4 != 0 or année%100 == 0) and année%400 != 0 ## Question 4.4 # (int,int,int,int,int,int)-> bool def majeur(j0,m0,a0,j1,m1,a1): return a1>a0+18 or (a1==a0+18 and m1>m0) or (a1==a0+18 and m1==m0 and j1>=j0) ## Question 4.5 # (int,int,int,int,int,int)-> bool def mineur(j0,m0,a0,j1,m1,a1): return a1<=a0+18 and (a1!=a0+18 or m1<=m0) and (a1 != a0+18 or m1!=m0 or j1 str def bonjour(prénom, nom): return "Bonjour " + prénom + " " + nom + " !" ## Question 4.7 # (str,int) -> str # Ne marche pas pour n <= 0 def répétition(mot,n): return (n-1) * (mot + ", ") + mot print("\nExercice 5\n") # Question 5.1 # Question 5.2 # Question 5.3 # Question 5.4 # Question 5.5