Tutorpip← About this lessonABCHide the answer keyDownload PDF
Coding · Ages 10+ · Set A
Bo the weather reporter
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: If runs its lines only when the condition is true, and else runs when it is false. Two equals signs compare.

Read and answer

Read the story, then answer.

One program, two answersBo is the weather reporter at the Robot Club show, but a robot cannot see the weather. Ms. Ito says a computer chooses by asking a question that is only ever true or false, and a question like that is called a condition. Zara's plan is if weather == "rain": print Take an umbrella, then else: print Wear a hat. The lines pushed in under if belong to the if, and else has its own colon and its own pushed-in line. The weather box holds sun, so the condition is false. Python skips the umbrella line and runs else.
1
Zara changes line 1 to weather = "rain". What does Bo say?
☂️Take an umbrella🧢Wear a hat🤐Nothing
2
The box stars holds 4. Which condition is true?
stars > 4stars < 3stars == 4stars >= 5
3
Two equals signs ask whether two things are equal.
TrueFalse
4
One equals sign a value in a box.
skipsputsasks
5
One of these lines has a mix-up to fix. Which one?
if weather == "rain":if weather == "rain"else:
6
The lines under if run every time, whatever the condition says.
TrueFalse

Match, order and fix

7
Join each part to what it does.
  1. 1if
  2. 2else
  3. 3==
  4. 4=
  • Aputs a value in a box
  • Bruns its lines only when the condition is true
  • Casks whether two things are equal
  • Druns when the condition is false
8
The weather box holds sun. Put what Python does in order.
  • Python checks the condition
  • Python skips the lines under if
  • Python runs the lines under else
  • The condition is false
9
The box weather holds snow. Circle every condition that is true.
weather == "rain"weather == "snow"weather != "rain"weather != "snow"
10
Lines pushed in under an if line are said to be .
repeatedindenteddeleted
11
When the condition is false, Python skips the lines under if and runs the else lines.
TrueFalse
12
Write one more rule for Bo, such as what to say when it is snowy.
13
Draw a fork in a path, with one way for yes and one way for no.
Scan the code at the top to mark this sheet on screenTake a photo of your answers or type them. It is marked for you automatically, and your score is kept.
Answer key · Set A
Bo the weather reporter
1Take an umbrella The condition weather == "rain" is now true, so the lines under if run.
2stars == 4 Four equals four, so stars == 4 is true. Four is not bigger than 4, smaller than 3, or 5 or more.
3True One equals sign puts a value in a box. Two equals signs compare.
4puts One equals sign puts a value in a box. Two ask a question.
5if weather == "rain" An if line ends with a colon, and the second line has none.
6False If runs its lines only when the condition is true.
71-B, 2-D, 3-C, 4-A If and else choose a path, and one equals sign stores while two compare.
81, 3, 4, 2 Python checks first, then skips the path that does not fit and runs the one that does.
9weather == "snow", weather != "rain" The box holds snow, so == "snow" is true, and != "rain" is true because snow is not rain.
10indented Being pushed in, or indented, shows which lines belong to the if.
11True Else runs when the condition is false.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.