Sequence, input & output · Sequência, entrada e saída
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.
Um programa roda em ordem
- Um programa é uma lista de etapas.
- Python as executa de cima para baixo, uma de cada vez.
- Essa ordem é chamada de sequência — a primeira ideia do currículo.
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 vira print()
- Na prova, OUTPUT mostra algo na tela.
- No Python, isso é
print(). - O texto dentro das aspas é impresso, depois uma nova linha começa.
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 vira input()
- Na prova, INPUT lê o que o usuário digita.
- No Python, isso é
input(). - Sempre retorna uma string (texto), mesmo se o usuário digitar 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.
Transformar entrada em número
input()retorna texto, então"5"não é o número 5.- Envolve com
int()para obter um número inteiro. - Agora você pode fazer matemática com ele.
age = int(input())
print(age + 1)
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
Na prova: pseudocódigo
- A mesma ideia no pseudocódigo Cambridge usa
INPUTeOUTPUT.
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.
Erros comuns
- As instruções são executadas de cima para baixo, na ordem em que você as escreve.
input()retorna texto (uma string); useint(...)quando precisar de um 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.
Agora você tenta
- Use
print()para mostrar a saída. - Use
input()para ler uma linha — deixe os colchetes vazios aqui. - Clique em Check answer para testar seu código.
Input → process → output · Entrada → processamento → saída
Most programs follow one shape: get input, do something, show output. · A maioria dos programas segue uma forma: obter entrada, fazer algo, mostrar saída.
Print these three lines, in order: Ready, then Set, then Go — one per line. · Imprima estas três linhas, na ordem: Ready, depois Set, depois Go — uma por linha.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.
Read a name with input(), then print Hello, then the name then !. For the input Sam, the output should be Hello, Sam!. · Leia um nome com input(), depois imprima Hello, , em seguida o nome e então !. Para a entrada Sam, a saída deve ser Hello, Sam!.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.
Read a whole number with input(), convert it with int(...), then print it doubled (times 2). For input 6, the output should be 12. · Leia um número inteiro com input(), converta-o com int(...), depois imprima-o dobrado (vezes 2). Para entrada 6, a saída deve ser 12.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.