0% found this document useful (0 votes)
2 views13 pages

Lesson 4 Python Maths Score

This document outlines the learning outcomes for Lesson 4 of a Python programming course, focusing on maintaining and displaying a score in a game. It explains how to use variables to add scores, provide responsive feedback based on the score, and convert integers to strings for display purposes. Additionally, it includes homework assignments for students to create quiz questions for the next lesson.

Uploaded by

jacoxod778
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views13 pages

Lesson 4 Python Maths Score

This document outlines the learning outcomes for Lesson 4 of a Python programming course, focusing on maintaining and displaying a score in a game. It explains how to use variables to add scores, provide responsive feedback based on the score, and convert integers to strings for display purposes. Additionally, it includes homework assignments for students to create quiz questions for the next lesson.

Uploaded by

jacoxod778
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

COMPUTER

PROGRAMMING
PYTHON
Learning Outcomes
–Lesson 4
Demonstrate use of variables
to add score to a game
Add responsive score feedback
to the game
Remember this from last lesson?
Maintaining score throughout game
With just a few lines of extra
code you should be able to
maintain the score throughout
the game and give some
feedback at the end.
Open your file saved from last
lesson called maths_questions
Code to add the score
Score = score + 1
Think, pair share
Do you understand what
score = score + 1
means?
Display the score at the end of the game
What code would you have to
type in to display the score at the
end of the game?
Answer
print (score)
Even better if you did this:
print (“Your score was “ +str
(score))
Why do you need to type in
str (score) ?
str (score)
The score variable is an integer
Python cannot add it to the end of
a string.
So the str() function converts it to
a string for the purpose of this line
of code.
Python cannot add strings and
integers together when printing
Responsive feedback solution
score = 0
if score > 2:
print (“Well done!”)
else
print (“Oh dear”)
Responsive feedback solution
Even better if:
“Well done, you scored 3 out of 3 –
very clever”, “Oh dear, you only
scored 1 out of 3 – why not try
again to improve”
Review
–Lesson 4
Demonstrate use of variables
to add score to a game
Add responsive score feedback
to the game
Homework - Questions
Come up with 5 questions you would like to
test in a program
For example – What is the capital of France
Ensure you have the answers too!

Next lesson you will have a test where you will


need to write a quiz using your questions in
python and include a score.
You may want to practise your coding from
today before next lesson.

You might also like