Creating a quiz program with Python

LESSON – Creative Writing with programming

Lesson Objectives

  • Using programming to create a quiz game

Success Criteria

  • undesrtand how to use a count variables (e.g. Score)
  • embed a count variables in an IF statement
  • customise and refine programs further with print functions

Keywords

  • Input
  • Selection
  • Variable
  • Count

Commands

  • input()
  • int()
  • score
  • score = score + 1

Starter

What do you think, what will be the output of the below codes, if the answer given to first one is “4” and the second one is “Milan”

Question 1

Question 2

Discuss your result with the person next to you.

Task 1 – Writing a simple quiz program

Write this simple quiz program in python and save it as a Simple Quiz

You can modify the questions and make it your own ones! and Run your program see if it going to work the way you want it.

Task 2 – Adding score to your quiz

At end of your code add this line print(“Your current score is: “ , score)

Once you have complete this task run your program and see if it is outputting anything different than earlier version.

Task 2 – Modify your program

Your program should calculate the score for all your questions

make sure you have add this line score = score +1
to all your questions
if the score is more than 10 it should print:

Well done! Your score is 12!

else it should print

Your score is 8! You need to do some revision!

Task 3 – Do further modification

Modify your program even further checking knowledge of the user to carry out on your quiz.

If the user gets the questions correct as you have in your code score goes up by 1.

score = score +1

when they get answer wrong you should minus their score by 1 using this code.

score = score -1

Also ask user their name that later you can print the score like this one;
Zakaria, your score is 7

Once you have finished with your quiz program save it as myQuiz.py in your python folder and run (F5) it.

Home learning – due in two weeks

Follow the instructions on the home learning document and complete your task, if you are having problem understating the task you need to see me before the due date.

Your home learning worksheet in your Show My Homework account.
Use the below link to help you with your task
Variables