Python - 2024

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

In deze les zit 23 slide, met interactieve quiz, tekstslide en 1 video.

time-iconLesduur is: 50 min

Onderdelen in deze les

Python programming 
Lesson 1 

Slide 1 - Tekstslide

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

Aspire: Create your own functions in python.

Slide 2 - Tekstslide

Slide 3 - Video

Slide 4 - Tekstslide

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

Slide 5 - Tekstslide

What will this code do?

Slide 6 - Open vraag

Lets check your prediction 
Run the code

Click the green play button

Slide 7 - Tekstslide

Run the following code:

What has changed about this code?

Slide 8 - Open vraag

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 - Tekstslide

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 - Tekstslide

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 - Tekstslide

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 - Quizvraag

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 - Quizvraag

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 - Tekstslide

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 - Tekstslide

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 - Tekstslide

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

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

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

Slide 19 - Quizvraag

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

Slide 20 - Quizvraag

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

Slide 21 - Quizvraag

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

Slide 22 - Quizvraag

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 - Tekstslide