Week2VariablesMathComments.pdf


Preview of PDF document week2variablesmathcomments.pdf

Page 1 2 3 4 5 6 7 8

Text preview


RHHS Compsci 2016



It then checks if the height is greater than 1000, and if it is, it would show another

message.
This is an example of if statements in effect. When the first if statement checks the variable, it
could either be true or false. If the condition is satisfied, then the indented piece of code
displaying “Like everyone else, you are shorter than Callum.” will be run. It will then go on to
run the pieces of code below.
If the condition is false (not satisfied), then it will skip over that, and go on to check the
second if statement.
Notice that the statement is ​one indent right of the condition​. This is how Python realizes
that a line is part of an if-statement so proper indentation really matters. Also remember to
put a ​colon after your condition​. It’s the most annoying thing in the world but you gotta put
it.