Year 7 · Python · Challenge 4

Locked Quiz Challenge

Check a password first. Then run a 5-question times-table quiz, score the answers, and print a grade.

passwordfor + ifscorecombined

Scenario: You are building a locked quiz for Year 7 maths revision.

Part A — Password

  1. Ask for a password.
  2. If it is exactly y7python, print Access granted and continue.
  3. Otherwise print Access denied and do not run the quiz. (Put the quiz code inside the if.)

Part B — Quiz

  1. Ask 5 questions: What is 1 x 8?, then 2 x 8?, … up to 5 x 8?. Use a for loop.
  2. If the answer is correct, add 1 to the score and print Correct!.
  3. If wrong, print the right answer.

Part C — Grade

  1. Print the final score out of 5.
  2. Print a grade:
    • 5: Grade: Excellent
    • 3 or 4: Grade: Good
    • below 3: Grade: Keep practising
💡 Try the whole challenge in your editor first. Only reveal the solution when you have had a proper go.

Previous: Challenge 3 · Year 7 tutorial