Sequence, input & output · Secuencia, entrada y salida
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 programa se ejecuta en orden
- Un programa es una lista de pasos.
- Python los ejecuta de arriba hacia abajo, uno a la vez.
- Este orden se llama secuencia — el primer concepto del temario.
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.
La SALIDA se convierte en print()
- En el examen, SALIDA muestra algo en la pantalla.
- En Python, eso es
print(). - El texto dentro de las comillas se imprime y luego comienza una nueva línea.
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.
La ENTRADA se convierte en input()
- En el examen, ENTRADA lee lo que escribe el usuario.
- En Python, eso es
input(). - Siempre devuelve un string (texto), incluso si el usuario escribe dígitos.
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.
Convertir la entrada en un número
input()devuelve texto, por lo que"5"no es el número 5.- Envuélvalo con
int()para obtener un número entero. - Ahora puedes hacer matemáticas con él.
age = int(input())
print(age + 1)
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
En el examen: pseudocódigo
- La misma idea en el pseudocódigo de Cambridge utiliza
INPUTyOUTPUT.
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.
Errores comunes
- Las sentencias se ejecutan de arriba hacia abajo, en el orden en que las escribes.
input()devuelve texto (un string); usaint(...)cuando necesites un número.
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.
Ahora tú intentas
- Usa
print()para mostrar salida. - Usa
input()para leer una línea; deja los paréntesis vacíos aquí. - Presiona Comprobar respuesta para probar tu código.
Input → process → output · Entrada → proceso → salida
Most programs follow one shape: get input, do something, show output. · La mayoría de los programas siguen una estructura: obtener entrada, hacer algo, mostrar salida.
Print these three lines, in order: Ready, then Set, then Go — one per line. · Imprime estas tres líneas, en orden: Ready, luego Set, luego Go — una por línea.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.
Read a name with input(), then print Hello, then the name then !. For the input Sam, the output should be Hello, Sam!. · Lee un nombre con input(), luego imprime Hello, , seguido del nombre y luego !. Para la entrada Sam, la salida debe ser Hello, Sam!.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.
Read a whole number with input(), convert it with int(...), then print it doubled (times 2). For input 6, the output should be 12. · Lee un número entero con input(), conviértelo con int(...), luego imprímelo duplicado (por 2). Para la entrada 6, la salida debe ser 12.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.