Aller au contenu

DS0010 (Corrigé)⚓︎

Exercice 1

Question 1: 6

Question 2: 10100011

Question 3: 9D

Question 4: C3

Question 5: a = b

Question 6: x == 3 or y == 5

Question 7: 4

Question 8: IndentationError

Exercice 2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 # Question 1
score = 0
score = score + 100
# ou
score == 100

 # Question 2
largeur_ecran = 640
hauteur_ecran = 400

 # Question 3
 z = x
 x = y
 y = z

 # ou
 z = y
 y = x
 x = z

Exercice 3

H
O
M
E
R
D'oh!

puis

19 9 1

Exercice 4

  1. range(5) donne la séquence d'entiers 0, 1, 2, 3, 4.
  2. range(2, 10) donne la séquence d'entiers 2, 3, 4, 5, 6, 7, 8, 9.
  3. range(0, 20, 3) donne la séquence d'entiers 0, 3, 6, 9, 12, 15, 18.

Exercice 5

1
2
for k in range(1, 14):
    print(f"Vendredi {f}")

Exercice 6

1
2
3
print("Voici le verdict du Choixpeau Magique :")
for prenom in ["Harry", "Hermione", "Ron", "Neuville"]:
    print(f"{prenom}, maison Griffondor")

Exercice 7

1
2
3
4
5
films = [Retour vers le futur, Le Parrain, Iron-Man, Rambo]
print("Mes films favoris:")
for film in films:
    for i in range(1, 4):
        print(film, i)