Python

Python 
Year 7 - Lesson 1 
1 / 24
volgende
Slide 1: Tekstslide
ComputingLower Secondary (Key Stage 3)

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

time-iconLesduur is: 50 min

Onderdelen in deze les

Python 
Year 7 - Lesson 1 

Slide 1 - Tekstslide

Can you create some instructions for making a 'Cup of Tea'?

Slide 2 - Open vraag

Where might we find instructions?

Slide 3 - Tekstslide

KO: To show understanding of programming in Python.
All 
  • To understand the 'syntax' of Python and why it is needed.
  • To understand how to create print statements with python.

Most
  • To be-able to code using Python, whilst understanding the syntax of Python.

Some
  • To be-able to 'debug' code and understand why 'debugging' is needed.

Slide 4 - Tekstslide

What is programming? Why do we need it?
Computers do not have their own brains, so we must tell them what we want them to do. This is where we use programming/coding!

The programming uses instructions,  like we have just established.

There are lots of programming languages, such as HTML, Python, C++, C and JavaScript. There are many more...




Slide 5 - 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 6 - Tekstslide

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


  • Think about our 'English'. It is important that we use correct punctuation, such as Commas and Full Stops. If we didn't, it would make our writing difficult to read.


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

Create with Code

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

Slide 8 - Tekstslide

Task 1: Use create with code to answer these 4 questions.

What is your first name?
What is your last name?
How old are you?
What school do you go to?

Slide 9 - Tekstslide

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

Task 2 
I now want you to add comments to each line of code that you have created.

Slide 11 - 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 12 - Tekstslide

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

Slide 13 - Tekstslide

Task 3
In this task, you will need to debug the code using the error messages that create with code provide.

Click here

Slide 14 - Tekstslide

Variables Video

Slide 15 - Tekstslide

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.



  • To use a variable, you first need to give it a name. This is like labelling the box with the word "apple" so you know what's inside. In programming, you can choose any name you want for your variable, as long as it follows certain rules. For example, the name can't have spaces in it, and it can't start with a number.



Slide 16 - Tekstslide

Let's look at how we would declare a variable
name = "bob"
print (name)




Slide 17 - Tekstslide

What's the difference between these two?
print (name)

print ("name")

Slide 18 - Tekstslide

How else can we use a Variable?
name = "bob"
print("my name is" , name)

Slide 19 - Tekstslide

Can you create your own?
Can you create your own sentence using a variable?

Slide 20 - Tekstslide

What symbol do I use to comment code?

Slide 21 - Open vraag

What function do I use if I want someone to enter information?

Slide 22 - Tekstslide

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

Slide 23 - Quizvraag

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