AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Words that join conditions

Week 8 · 1.4 Conditional statements in text-based programming · 3 lessons
Answers are for parents and teachers.
1
Work out each result for x = 3 and y = 9: (a) x < 5 and y < 5 (b) x < 5 or y < 5 (c) not (x == 3).
Python
1x = 3
2y = 9
2
Write a Python program: ask for a number. If it is between 10 and 20 (including both) print In range, otherwise print Out of range.
3
A program should accept maybe, Maybe and MAYBE. Write the condition.
4
For each line say syntax, runtime or logic error: (a) if mark > 50 or mark < 100: to check that a mark is between 50 and 100 (b) if mark > 50 with no colon (c) print(total) when total was never set.
5
Explain why trace tables are useful when a program has and and or in the same condition.