Python lesson 1

Python programming
Year 9 - Lesson 1 
1 / 20
volgende
Slide 1: Tekstslide
ComputingLower Secondary (Key Stage 3)

In deze les zitten 20 slides, met interactieve quizzen en tekstslides.

time-iconLesduur is: 50 min

Onderdelen in deze les

Python programming
Year 9 - Lesson 1 

Slide 1 - Tekstslide

I am an alien from out of space and I have just landed on earth! I have been told to put some clothes on!
Can you create some instructions for 'Getting Dressed'?

Extension:

Slide 2 - Open vraag

In this lesson, you will...

Conquer: Define programs and describe how they are executed.


Aspire Higher: Write and execute your first Python programs. This will include displaying messages, creating and using variables and input from the keyboard.

Slide 3 - Tekstslide

In previous units, you...

Used a block-based programming language such as (Scratch) to create programs that involved:
  • Variables, operators, and expressions
  • Sequence, selection, and iteration
  • Subroutines
  • Lists

Slide 4 - Tekstslide

Python
  • High level programming language
  • Allows you to create your own programs
  • Text based

Slide 5 - Tekstslide

Programs
  • A program is a set of precise instructions, expressed in a programming language.
  • Translating the programming language is necessary for a machine to be able to execute the instructions.

Slide 6 - Tekstslide

Task 1 - Printing an Output

Copy the below code, then click 'RUN' in the bottom right corner.

Slide 7 - Tekstslide

Python Programming
The first program, that any programmer produces, when learning how to code, is the "Hello World!" program.
It is a simple program, that displays text to the screen.

Slide 8 - Tekstslide

What is Syntax?
  • The way we write a line of code is important, as the computer needs to recognise it.


  • 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 9 - 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 10 - 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 11 - Tekstslide

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

Slide 12 - 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 13 - Sleepvraag

Commenting our code. What is the importance?
  • By commenting our code,  it tells you (the programmer) and anyone else who looks at the code what it does.

  • By using the '#' symbol, it will not display when your code has been run.

Below is an example


Slide 14 - Tekstslide

What symbol do I use to comment code?

Slide 15 - Open vraag

What is the process of checking a program for errors?
A
Error checking
B
De-bugging
C
Error finding
D
Mistake finding

Slide 16 - Quizvraag

Variables 
  • In programming, a variable is like a container that holds a piece of information. This information can be anything, like a number, a word, or even a whole sentence!


  • For example, imagine you have a box that can hold a piece of fruit. You can put an apple in the box, and then later on, you can take the apple out and look at it. In programming, a variable is like that box. You can put information into the variable, and then you can use that information later on in your program.





Slide 17 - Tekstslide

Task 3 - Variables
We are now going to create a variable and then save some data to it. We will then output "print" this data to the screen.

Press the green play button to execute the code.

Slide 18 - Tekstslide

Task 4 : Create an adventure using inputs, outputs and variables to create a story!
Can you create a story like the one below - feel free to change the questions!
Use as many variables as possible to create a customisable story

Slide 19 - Tekstslide

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