Python lesson 3

Python programming 
Lesson 3
1 / 21
next
Slide 1: Slide
ComputingLower Secondary (Key Stage 3)

This lesson contains 21 slides, with interactive quizzes and text slides.

time-iconLesson duration is: 50 min

Items in this lesson

Python programming 
Lesson 3

Slide 1 - Slide

This item has no instructions

Edit the following code:
Add a question for the user asking them how their day is.
Extention: Why is the input code important?
Click Here

Slide 2 - Open question

This item has no instructions

Oracy survey 
Complete the following student survey

This should take you around 5 Mins 

Slide 3 - Slide

This item has no instructions

KEY OBJECTIVE
Conquer: To understand the need for conditional statements

Aspire: Create your own conditional statements. 

Slide 4 - Slide

This item has no instructions

Previously you have:

Written a program in a sequence
Used the print statement
Used a subroutine
Checked for errors in your code
Fixed common errors in your code
Added inputs to allow the user to respond/

Slide 5 - Slide

This item has no instructions

PRIMM
All new programmers use the PRIMM method to learn and create new code. There are 5 key stages. 
  1. Predict
  2. Run
  3. Investigate
  4. Modify
  5. Make

Slide 6 - Slide

This item has no instructions

Task 1 - PREDICT
Adding conditions

We have been taking inputs, storing variables and outputting results to the screen

Now we need to add some conditions.

Slide 7 - Slide

This item has no instructions

What will the output be if I enter the number 10?

Slide 8 - Open question

10 is more than 5

Statement is true

Output 10+5 = 15
What will happen in this program if I enter "sunny" and then "raining"?

Slide 9 - Open question

10 is more than 5

Statement is true

Output 10+5 = 15
Lets check your prediction 
Run the code

Click the green play button

Slide 10 - Slide

This item has no instructions

INVESTIGATE and MODIFY
  • Add another question
  • Ask the user how they are feeling
  • If the user enters happy give a positive message.
  • If they enter unhappy give a hopeful message. 


Slide 11 - Slide

This item has no instructions

Conditional statements
If statements allow the program to give different responses to user inputs. 



Slide 12 - Slide

This item has no instructions

Create a 5 question quiz
Create 5 quiz questions about capital cities. 

1 example question has been provided for you.

Click here

Slide 13 - Slide

This item has no instructions

Predict:


What will the outcome of this code be?
A
Hello world will appear
B
"Hello world" will appear
C
Nothing
D
An error will occur

Slide 14 - Quiz

This item has no instructions

Predict:

What will the outcome of this code be?
A
Error on line 4
B
Error on line 7
C
Hello there
D
Nothing

Slide 15 - Quiz

This item has no instructions

Which code below will call a function?
A
def menu()
B
Hello world
C
menu()
D
score = 0

Slide 16 - Quiz

This item has no instructions

What is the process of fixing errors in your program?
A
Error checking
B
Debugging
C
Syntax errors
D
Python

Slide 17 - Quiz

This item has no instructions

What is the name of the format we have to write in python
A
Grammar
B
Debugging
C
Syntax
D
Functions

Slide 18 - Quiz

This item has no instructions

What keyword do we use to create a function?
A
def
B
Define
C
def()
D
Define function.

Slide 19 - Quiz

This item has no instructions

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 20 - Drag question

This item has no instructions

Mastery typing task
To become efficient programmers we must get better and faster at typing

Slide 21 - Slide

This item has no instructions