Python Programming · Middle Stage (6–8) · 1 course, 14 worked problems, 20 practice questions
A mini project brings the basic skills together in one small, complete program. Examples are a number guessing game, a quiz that keeps a score and a grade book for a class. Each project uses variables, input and output, conditionals, loops, lists and functions together. You start by writing down what the program should do. Then you build it in small steps and test it after each step. When it works, you improve it, for example by checking what the user types or by adding a menu. Fixing your own bugs is part of every project.
Choose an answer, then check it. Each one shows a full explanation.
score_for(tries) returns max(0, 100 - 10 * (tries - 1)). What is score_for(5)?
The grade book gives A from 90, B from 75, C from 60 and D below that. How many of the marks 91, 48, 77, 60, 66 get a C?
A quiz has 8 questions and a student gets 7 right. What does print(round(7 / 8 * 100)) show?
A program should add 1 to 10, but its loop is for i in range(1, 10). It runs without an error and shows 45. What is the mistake?
Which numbers can random.randint(1, 6) give?
A student scores 3 out of 4 in a quiz. What is the percentage?
What does reply.lower().strip() make of " PaRiS "?
In a quiz, why must the lists questions and answers be in the same order?
A student adds a question to questions but forgets to add its answer. What happens when the quiz reaches it?
Which loop condition stops the guessing game after at most 7 guesses?
Each one has a hint, the key idea and a full worked solution.