Wat is LessonUp
Zoeken
Kanalen
Inloggen
Registreren
‹
Terug naar zoeken
Python - Updated
Python
Year 7 - Lesson 1
1 / 45
volgende
Slide 1:
Tekstslide
Computing
Lower Secondary (Key Stage 3)
In deze les zitten
45 slides
, met
interactieve quizzen
,
tekstslides
en
4 videos
.
Lesduur is:
50 min
Start les
Bewaar
Deel
Printen
Onderdelen in deze les
Python
Year 7 - Lesson 1
Slide 1 - Tekstslide
KEY OBJECTIVE
To program a computer using the python programming language
Slide 2 - Tekstslide
Slide 3 - Video
PRIMM
We will be using the PRIMM approach when we learn to code
Predict
Run
Investigate
Modify
Make
Slide 4 - Tekstslide
Task 1 - PREDICT
What do you think this code will do?
Slide 5 - Tekstslide
What will the code do?
Slide 6 - Open vraag
RUN
run the code
Slide 7 - Tekstslide
INVESTIGATE and MODIFY
Using the code you have try and:
make it say a different message
Make the message print 3 times by calling the procedure multiple times
Slide 8 - Tekstslide
MAKE
Create your own program that will:
Have a procedure called "computing" that prints the message "I love computing"
In the main code call that procedure
Here is a blank coding window
Slide 9 - Tekstslide
Slide 10 - Video
What is Syntax?
Rules of writing the code
Breaking the rules means errors
So it is important!
where spaces are and aren't
where punctuation marks are like ""
using colons : correctly
using indentation
Slide 11 - Tekstslide
What is
debugging
?
You will make mistakes....frequently
When this happens you will get error messages
You need to remove the bugs to make it work
So we call this debugging
Slide 12 - Tekstslide
Debugging
Continued...
Create with code, shows you where your error is. Below is a screenshot that shows this.
Slide 13 - Tekstslide
Task 2 - Debugging
In this task, you will need to debug the code using the error messages that
create with code
provide.
Click here
Slide 14 - Tekstslide
Slide 15 - Video
Variables
Computers need to store data for you that the program needs (like health, XP, points)
These are called VARIABLES
In python we declare these using a suitable name and then assign them values
LIKE
health = 100
xp = 0
points = 0
All Variables should:
Have a sensible name
be lower case
have no spaces (only one word long)
Slide 16 - Tekstslide
Task 3 - Variables - Predict
PREDICT
Slide 17 - Tekstslide
What do you think the code will do?
Slide 18 - Open vraag
RUN
run the code
Slide 19 - Tekstslide
INVESTIGATE and MODIFY
Using the code try the following:
Fix the call for procedure1
make the program call the other two procedures as well
Change the name in the printing2 procedure to your name
(Harder) Add more text after the greeting in printing3 so it will print the following --> "Hello Sally , nice to meet you"
Slide 20 - Tekstslide
Taking input
We can ask the user for inputs into our programs.
So lets get the computer to do this
Slide 21 - Tekstslide
PREDICT
Slide 22 - Tekstslide
What do you think this code will do when run?
Slide 23 - Open vraag
RUN
Run the program
Slide 24 - Tekstslide
INVESTIGATE AND MODIFY
Try and do the following:
change the procedure name for printmyname() to printname()
add two more input questions to the askmestuff() procedure about a favourite hobby and place in the world and store them in suitable variables
add another print statement to the same procedure to print suitable text using the new stored variables.
Slide 25 - Tekstslide
MAKE
Create your own program that:
has a procedure that asks 2 questions and stores them as variables
calls this procedure from the main code
results in a sentence being printed, using the stored variables
Here is a blank coding window
Slide 26 - Tekstslide
Syntax errors?
Let's test some of those error checking skills
On the next drag and drop which bits of code are correct and which would cause an error?
Slide 27 - Tekstslide
CORRECT
CAUSE AN ERROR
print = ("Hello")
Print("Yes!")
print("this one)
name = imput("what is your name")
name = input("what is your name")
print("this text")
fav colour = "Green"
age = 10
print("Hello", name)
print("Bye",name")
Slide 28 - Sleepvraag
Commenting our code. What is the importance?
Comments are like post-it notes on your code
The computer will ignore them when you write them
The explain code and help you come back and edit it later
Slide 29 - Tekstslide
What symbol is used to tell Python you are writing a comment?
A
:
B
""
C
()
D
#
Slide 30 - Quizvraag
What is the process of checking a program for errors by running it and fixing the issues?
A
Error checking
B
De-bugging
C
Error finding
D
Mistake finding
Slide 31 - Quizvraag
What type of information can be stored in a variable?
A
Only videos
B
Only sounds
C
Only pictures
D
Numbers, text, and other types of data
Slide 32 - Quizvraag
Adding conditions
We have been taking inputs, storing variables and outputting results to the screen
Now we need to add some conditions.
Slide 33 - Tekstslide
PREDICT
Slide 34 - Tekstslide
What do you think this code would do?
Slide 35 - Open vraag
RUN
Run the code
Slide 36 - Tekstslide
Slide 37 - Video
Investigate and Modify
Change the code here
to do the following:
Change the condition to check if the name is equal to "Bob"
if it is "Bob" then say "Hey there Bob! I know you!"
else then print out "Have you seen Bob anywhere?"
Slide 38 - Tekstslide
MAKE
Make a program that
Has a procedure called checkfood():
Ask the user to enter their favourite food and store it as a suitable variable
Check if their favourite food is "pizza" or not
If it is then print something positive about it
If it isn't then say something negative about it
Call the procedure you made in the main code routine
Here is a blank to code in
Slide 39 - Tekstslide
If this, if that
Sometimes we need to check for more than one thing
And we need to check for certain things in a certain order
This is where "elif" comes in
it stands for ELSE IF
you only check the elif when the first if has failed
you can then add as many of these as you like
and they get checked in order until one if met
if none are met then the code under the ELSE part will run
Slide 40 - Tekstslide
PREDICT
Slide 41 - Tekstslide
RUN
try running the code
Slide 42 - Tekstslide
Investigate and Modify
With this code
try and:
Edit the names and responses the code is looking for in the various statements
add an additional elif statement to look for an additional name
Slide 43 - Tekstslide
MAKE
Make your own version of an if/elif/else statement which:
Has a procedure defined appropriately
asks the user to enter a favourite animal
checks the animal against 4 different animals, each with a specific response if they are selected
prints that it doesn't like the animal if it is not one of these 4
calls the written procedure in the main code routine
You can use this blank
Slide 44 - Tekstslide
Debugging task
Try and fix these faulty if statements
Slide 45 - Tekstslide
Meer lessen zoals deze
Python - Updated - 2025
1 day ago
- Les met
45 slides
Computing
Lower Secondary (Key Stage 3)
Python - 2024
June 2024
- Les met
45 slides
Computing
Lower Secondary (Key Stage 3)
Python - Updated
April 2024
- Les met
45 slides
Computing
Lower Secondary (Key Stage 3)
Python lesson 2
September 2024
- Les met
23 slides
Computing
Lower Secondary (Key Stage 3)
Revision
May 2024
- Les met
37 slides
Computer Science
Secondary Education
Python lesson 1
September 2023
- Les met
20 slides
Computing
Lower Secondary (Key Stage 3)
Python lesson 1
2 days ago
- Les met
20 slides
Computing
Lower Secondary (Key Stage 3)
Python - Updated
April 2023
- Les met
19 slides
Computing
Lower Secondary (Key Stage 3)