Wat is LessonUp
Zoeken
Kanalen
Inloggen
Registreren
‹
Terug naar zoeken
Y8 Python
Python
On the road to code!
1 / 38
volgende
Slide 1:
Tekstslide
Computing
Lower Secondary (Key Stage 3)
In deze les zitten
38 slides
, met
interactieve quizzen
en
tekstslides
.
Start les
Bewaar
Deel
Printen
Onderdelen in deze les
Python
On the road to code!
Slide 1 - Tekstslide
What is Python?
Slide 2 - Woordweb
Python
High level programming language
Allows you to create your own programs
Text based
Slide 3 - Tekstslide
Recall
Try these old recall questions on things you should know about programming
Slide 4 - Tekstslide
Code that runs one line after another is known as coding in...
A
Sequence
B
Selection
C
Iteration
D
Recursion
Slide 5 - Quizvraag
Code that repeats/loops is known as coding in...
A
Sequence
B
Selection
C
Iteration
D
Recursion
Slide 6 - Quizvraag
Code that only runs when a condition is met is known as coding in...
A
Sequence
B
Selection
C
Iteration
D
Recursion
Slide 7 - Quizvraag
An example of a loop in python would be:
A
print("this")
B
while x > 0 :
C
if x == 0 :
D
name = input("-->")
Slide 8 - Quizvraag
A value that is used by the program and can change is known as a...
A
constant
B
procedure
C
function
D
variable
Slide 9 - Quizvraag
Refresh
Time to refresh those skills
Slide 10 - Tekstslide
outputs
Used to output messages to the screen
In Python we use
print
print
(
"hello world"
)
Slide 11 - Tekstslide
create.withcode.uk
Slide 12 - Link
Variables
An area in memory used to store a value the program will use.
The value is likely to change
Here are some examples in Python
name =
"Dave"
- Text
health =
100
- Integer
discount =
False
- Boolean (True/False)
Slide 13 - Tekstslide
Inputs
We often use variables to store inputs from the user
In Python we use
input
input
(
"Question the user will see as a prompt"
)
So to store a name we would use:
name =
input
(
"What is your name ? --> "
)
Slide 14 - Tekstslide
Checkpoint
Label the correct parts of this code (drag them)
filmpref = input("What kind of films do you like? ")
Variable
This is aplaceholder for a value that will change in the program
function
This is a calling a pre-made function from the python library
All functions are followed by brackets ()
Sometimes information is written between these brackets
This is called a "parameter"
Parameter
This is a text prompt which is the parameter of the input function.
It will pop up on screen before taking an input from the user
Slide 15 - Tekstslide
create.withcode.uk
Slide 16 - Link
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 17 - Sleepvraag
IF/ELIF/ELSE
When we need to make a decision in a program we use a selection statement .
In Python we use
if elif
and
else
Let's look at some coded examples...
Slide 18 - Tekstslide
create.withcode.uk
Slide 19 - Link
Now Try Yourself
Slide 20 - Tekstslide
create.withcode.uk
Slide 21 - Link
In python you must write IF, ELIF and ELSE in capital letters
A
TRUE
B
FALSE
Slide 22 - Quizvraag
After every if, elif and else statement you put ...
A
;
B
}
C
:
D
#
Slide 23 - Quizvraag
An elif part of the code will only run if the if part was not met
A
True
B
False
Slide 24 - Quizvraag
an if statement must always have an else component
A
True
B
False
Slide 25 - Quizvraag
which of the following if statements would cause an error
A
if name != "Fred":
B
if password == guess:
C
if name = "Bobby":
D
if age >= 18 :
Slide 26 - Quizvraag
While Loops
Sometimes you need the computer to repeat steps until a certain condition has been met
In Python we use
while
and
for
Let's look at some coded examples of a while loop...
Slide 27 - Tekstslide
create.withcode.uk
Slide 28 - Link
Your Turn
Making a quiz question program
Slide 29 - Tekstslide
create.withcode.uk
Slide 30 - Link
Lists
When we code we need to store things
A variable is one example
Sometimes we need to store lots of things that are related in someway.
We call these places "
Data Structures
"
Slide 31 - Tekstslide
Lists
In python one of the most used data structures is a list
Lists are used to store similar data, one item after another
For example:
items you need to buy from a shopping list
names of students in a class
A list is an example of a 1 Dimensional array.
Slide 32 - Tekstslide
Lists?
What could we store?
Slide 33 - Woordweb
create.withcode.uk
Slide 34 - Link
Removing items
To remove items from a list is simple
we use:
listname.remove("itemname")
Bread
Milk
Cheese
Slide 35 - Tekstslide
create.withcode.uk
Slide 36 - Link
Challenges
Create a program that can do the following:
Offer the user 3 options
Add to the shopping list
Remove from the shopping list
print the shopping list to the screen
The program should also:
repeat and display the three options each time
take user input for new items and items that need removing
prevent users entering options that are not allowed
The program should exit if the user ever enters an "x"
Slide 37 - Tekstslide
Solution code
Link to solution
Slide 38 - Tekstslide
Meer lessen zoals deze
Python Lesson 5 - Recall
September 2023
- Les met
27 slides
Computing
Lower Secondary (Key Stage 3)
Y8 Python
Juli 2022
- Les met
30 slides
Computing
Lower Secondary (Key Stage 3)
Y8 Python - Low Ability - If Elif JM
Juni 2023
- Les met
40 slides
Computing
Lower Secondary (Key Stage 3)
Python Development Lesson 1 - JM Lesson Obs
Mei 2023
- Les met
35 slides
LessonUp
Lower Secondary (Key Stage 3)
Python Development Lesson 1
April 2023
- Les met
28 slides
LessonUp
Lower Secondary (Key Stage 3)
Python - Updated
April 2024
- Les met
45 slides
Computing
Lower Secondary (Key Stage 3)
Python - 2024
Juni 2024
- Les met
45 slides
Computing
Lower Secondary (Key Stage 3)
Cover Year 9 Python Lesson 2 180923
September 2023
- Les met
19 slides
Computing
Lower Secondary (Key Stage 3)