Python - 2024

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

This lesson contains 23 slides, with interactive quizzes, text slides and 1 video.

time-iconLesson duration is: 50 min

Items in this lesson

Python programming 
Lesson 1 

Slide 1 - Slide

KEY OBJECTIVE
Conquer: To understand the need for functions in a program.

Aspire: Create your own functions in python.

Slide 2 - Slide

Slide 3 - Video

Slide 4 - Slide

Task 1 - PREDICT
What do you think this code will do?

Slide 5 - Slide

What will this code do?

Slide 6 - Open question

Lets check your prediction 
Run the code

Click the green play button

Slide 7 - Slide

Run the following code:

What has changed about this code?

Slide 8 - Open question

Functions
A function is a set of code that runs on a command word. 

What do you think the command word is for this code?

Slide 9 - Slide

DEF
Def is short for define function. 

We are telling the computer that any code under this code word needs to be run we we use the code word. 


Slide 10 - Slide

INVESTIGATE and MODIFY
Using the code you have try and:
  • Make it say a different message
  • Make the message print 5 times by calling the function multiple times
  • CLICK ME

Slide 11 - Slide

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 12 - Quiz

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 13 - Quiz

MAKE
Create your own program that will:
  • Have a function called "computing" that prints the message "I love computing"
  • Make sure you call that function. 

Slide 14 - Slide

What is Syntax?
  • The way we write a line of code is important.

  • Think about our 'English'. It is important that we use correct punctuation, such as Commas and Full Stops.

  • If we do not use the correct symbols and spellings in our Python coding, then the computer will not be-able to run our programs.


Slide 15 - Slide

What is debugging?
  • Debugging code refers to the process of identifying and fixing errors, bugs, or defects in a computer program that we have created.

  • An error occurs, when you have done something wrong in your program. You could have spelt something wrong or even missed out a symbol...

Slide 16 - Slide

Debugging Continued...
Create with code, shows you where your error is. Below is a screenshot that shows this.

Slide 17 - Slide

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 18 - Slide

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

Slide 19 - Quiz

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

Slide 20 - Quiz

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

Slide 21 - Quiz

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

Slide 22 - Quiz

Lesson extension task
Create a new function that answers the following questions: 

What is your full name?
What was your favorite thing about the holidays? (Sleeping) 
What are you looking forward to in year 9?
Have you started thinking about options?
What can you improve on from last year? 

Slide 23 - Slide