Sequence, input & output · Séquence, entrée & sortie
A program runs in order
- A program is a list of steps.
- Python runs them from top to bottom, one at a time.
- This order is called sequence — the first idea in the syllabus.
Un programme s'exécute dans l'ordre
- Un programme est une liste d'étapes.
- Python les exécute de haut en bas, une par une.
- Cet ordre s'appelle la séquence — la première idée du programme.
print("Wake up")
print("Brush teeth")
print("Go to school")
OUTPUT becomes print()
- In the exam, OUTPUT shows something on the screen.
- In Python, that is
print(). - The text inside the quotes is printed, then a new line starts.
OUTPUT devient print()
- Dans l'examen, OUTPUT affiche quelque chose sur l'écran.
- En Python, c'est
print(). - Le texte entre guillemets est imprimé, puis une nouvelle ligne commence.
print("Hello, world!")
print("IGCSE Computer Science")
INPUT becomes input()
- In the exam, INPUT reads what the user types.
- In Python, that is
input(). - It always gives back a string (text), even if the user types digits.
INPUT devient input()
- Dans l'examen, INPUT lit ce que l'utilisateur tape.
- En Python, c'est
input(). - Elle retourne toujours un string (texte), même si l'utilisateur tape des chiffres.
name = input()
print("Hello, " + name)
Turn input into a number
input()gives text, so"5"is not the number 5.- Wrap it with
int()to get a whole number. - Now you can do maths with it.
Transformer l'entrée en nombre
input()retourne du texte, donc"5"n'est pas le nombre 5.- Enveloppez-le avec
int()pour obtenir un entier. - Maintenant vous pouvez faire des maths avec.
age = int(input())
print(age + 1)
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
Dans l'examen : pseudocode
- La même idée dans le pseudocode Cambridge utilise
INPUTetOUTPUT.
OUTPUT "What is your name?"
INPUT Name
OUTPUT "Hello, ", Name
Common mistakes
- Statements run from top to bottom, in the order you write them.
input()gives back text (a string); useint(...)when you need a number.
Erreurs courantes
- Les instructions s'exécutent de haut en bas, dans l'ordre où vous les écrivez.
input()retourne du texte (une chaîne) ; utilisezint(...)lorsque vous avez besoin d'un nombre.
Now you try
- Use
print()to show output. - Use
input()to read a line — leave the brackets empty here. - Press Check answer to test your code.
À vous maintenant
- Utilisez
print()pour afficher une sortie. - Utilisez
input()pour lire une ligne — laissez les crochets vides ici. - Appuyez sur Vérifier la réponse pour tester votre code.
Input → process → output · Entrée → traitement → sortie
Most programs follow one shape: get input, do something, show output. · La plupart des programmes suivent une forme : obtenir une entrée, faire quelque chose, afficher une sortie.
Print these three lines, in order: Ready, then Set, then Go — one per line. · Affichez ces trois lignes, dans l'ordre : Ready, puis Set, puis Go — une par ligne.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.
Read a name with input(), then print Hello, then the name then !. For the input Sam, the output should be Hello, Sam!. · Lisez un nom avec input(), puis affichez Hello, , ensuite le nom, puis !. Pour l'entrée Sam, la sortie doit être Hello, Sam!.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.
Read a whole number with input(), convert it with int(...), then print it doubled (times 2). For input 6, the output should be 12. · Lisez un nombre entier avec input(), convertissez-le avec int(...), puis imprimez-le doublé (multiplié par 2). Pour l'entrée 6, la sortie devrait être 12.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.