How Programs Follow Instructions
Computers execute code from the top of the file to the bottom — one line at a time.
They do not skip ahead.
They do not rearrange instructions.
They simply follow the exact order you write.
For example:
print("Line one")
print("Line two")
print("Line three")
The output will appear in that same order.
Every print() statement moves to a new line automatically.
Assignment:
In the opening scene of our game, the hero meets a mysterious talking bear named Ryan. The dialogue must appear in the correct sequence so the story makes sense. Rearrange the code below so that it prints in this exact order:
Ryan: Growl!
Hero: ...
Ryan: Where are you off to this morning? Grrrr...
Hero: Where did a bear learn to speak?
In the opening scene of our game, the hero meets a mysterious talking bear named Ryan. The dialogue must appear in the correct sequence so the story makes sense. Rearrange the code below so that it prints in this exact order:
Ryan: Growl!
Hero: ...
Ryan: Where are you off to this morning? Grrrr...
Hero: Where did a bear learn to speak?
Rearrange the dialogue lines
print("Hero: ...")
print("Ryan: Where are you off to this morning? Grrrr...")
print("Hero: Where did a bear learn to speak??")
print("Ryan: Growl!")