Presentation is loading. Please wait.

Presentation is loading. Please wait.

Superhero Quiz Year 9 Python.

Similar presentations


Presentation on theme: "Superhero Quiz Year 9 Python."— Presentation transcript:

1 Superhero Quiz Year 9 Python

2 Superhero Quiz - Intro You have been tasked in your role as a Python programmer to code a short quiz based on superheroes and an arch villain. The first step is to open Python and then select File -> New File this will allow you to store the code in the future. #Hint – use comments to explain sections of your code….

3 Superhero Quiz – Print commands
In your window use print functions for the following: A row of stars (****************************) The name of your game Created by your name Date today’s date Version 1.01 Another row of stars #You can include \n to space out the text onto new lines #Hint – use comments to explain sections of your code….

4 Superhero Quiz – Assigning variables
You are required to assign the following variables: Score = 0 Lives = 5 Playername = input(“ #You must complete the input code above… #Hint – use comments to explain sections of your code….

5 Superhero Quiz – Print commands including concatenation
Use print functions for the following: Welcome (Playername) you are the evil super villain. You must answer the following questions to help him catch the five superheroes who are currently thwarting his plans HINT: Use CAPS LOCK for all answers, only the letter A, B or C is required #You can include \n to space out the text onto new lines #You could include more stars to present the text more professionally #Hint – use comments to explain sections of your code….

6 Superhero Quiz – Question 1 (if statement)
We will use a variable QU1 to store the answer for the first question. The code for the first question is provided below: #Look carefully through this code. The question is asked, the answer is input. If the answer is correct the variable score has 10 added to it and a print is displayed #Hint – use comments to explain sections of your code….

7 Superhero Quiz – Question 2-5 (if statement)
For the remaining four questions you must enter the code (look back at question 1 to help you, the correct answer is in red) Qu2 Now is your chance to catch Spiderman, you have three sets of house keys. Whose will you select? A: Alfred Pennyworth, B: Lois Lane, C: Aunt May: Qu3 Which of the devices listed below will help us attract and catch Batman? A: Peter Parker's camera, B: Gotham City Search Light, C: Tie up Lois Lane #Hint – use comments to explain sections of your code….

8 Superhero Quiz – Question 2-5 (if statement)
For the remaining four questions you must enter the code (look back at question 1 to help you, the correct answer is in red) Qu4 Which of the following will weaken Superman to allow us to capture him? A: Kryptonite, B: High pitched noise, C: Cold temperature : Qu5 Wolverine is the final superhero to capture, which character can help us get into his mind ? A: The Joker, B: Professor Y (Carlton Young), C: Professor X (Charles Xavier): #Hint – use comments to explain sections of your code….

9 Superhero Quiz – Print commands including concatenation
Use print functions for the following: You have completed the superhero quiz A row of stars Your score is (score) #You can include \n to space out the text onto new lines #You could include more stars to present the text more professionally #Hint – use comments to explain sections of your code….

10 Superhero Quiz – Extension Tasks
Develop the If statements for all questions to do the following: Have an else option for if they have the incorrect answer. This should reduce lives by 1 and print out a statement highlighting that it is the incorrect answer. #Hint – use comments to explain sections of your code….

11 Superhero Quiz – Extension Tasks
Add a timer to make the user wait for their score to be displayed. To do this add the following: import time #ideally add at the top of your code time.sleep(1) #this will delay for one second before reading the next line of code #Hint – use comments to explain sections of your code….

12 Superhero Quiz – Extension Tasks
Add bonus points for lives remaining To do this you will need the following: A variable called bonus that will multiply lives by 25 Add the bonus on to your score for a new updated score Ensure the new score is printed out #Hint – use comments to explain sections of your code….

13 Superhero Quiz – Extension Tasks
Using an if and elif statement you must print the level of evil for the player. To do this you will need the following: if score is greater than 100 then "\n Congratulations you are a super villain" elif the score is greater than 60 then "You are evil but there is room for improvement!" else “I think you need to stay on the other side as you are not evil enough for us!!" #Hint – use comments to explain sections of your code….

14 Superhero Quiz – Extension Tasks
While loop to play again – can be tricky! To do this you will need the following: A variable called again that is set = “Yes” at the start of the code while again !=“no”: all code needs to be indented (your teacher will explain) again = input(“Do you want to play again?”) #Hint – use comments to explain sections of your code….

15 Superhero Quiz You have completed the code! Well done!!
Read through your solution and fine tune to improve presentation (e.g. blank lines, spaces so the cursor does not flash at the end of text for an input). Test to make sure that it works as you would expect. Add comments to explain sections of your code. Upload the Python code to Moodle.


Download ppt "Superhero Quiz Year 9 Python."

Similar presentations


Ads by Google