🏆

Leçon

Defis

🏆

Les boucles — le super pouvoir du code

Tu as remarqué quelque chose dans le cours 2 ?

❌ Pour un carré, tu écris ça :
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
8 lignes pour 4 côtés 😓
🤔
Les lignes forward + right sont identiques et répétées 4 fois.

En maths, on écrit 2×4 plutôt que 2+2+2+2.

En Python, on a les boucles pour ça !