Twilight 3 - Python Introduction

Twilight 3 - Python Introduction
1 / 16
volgende
Slide 1: Tekstslide
ComputingLower Secondary (Key Stage 3)

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

Onderdelen in deze les

Twilight 3 - Python Introduction

Slide 1 - Tekstslide

Deze slide heeft geen instructies

Example answers:
-They all show...
-Connected because...

What do these
have in common?

Slide 2 - Woordweb

They all show a system that provides a solution.
They are connected by a known method of instruction.
They all have systems.
What is Python?
  • A programming language that allows you to tell the computer what to do.
  • Allows you to develop systems that solve problems.
  • It is the most used programming language in the world.


Slide 3 - Tekstslide

Deze slide heeft geen instructies

W3 Schools
  • An online resources to learn, understand and test code from lots of popular languages.
  • We will be going to: https://www.w3schools.com/python/trypython.asp?filename=demo_compiler 

Slide 4 - Tekstslide

Deze slide heeft geen instructies

Orientation

Slide 5 - Tekstslide

Deze slide heeft geen instructies

Deconstruction of the code

Slide 6 - Tekstslide

Deze slide heeft geen instructies

What is the result of
running this code?

A
these values are. Strings,
B
Strings, these values are.
C
values are. these Strings,
D
"strings, these values are"

Slide 7 - Quizvraag

Deze slide heeft geen instructies

PRIMM
The abbreviation PRIMM stands for Predict, Run, Investigate, Modify, and Make.
Review and consider the following questions when you look at code:

Predict: What will the out come likely to be? How will it work?
Run: Run the code to find out, be ready for the results or the reports (or logs) that may display.
Investigate: were the results as expected? What was output in the reports (or logs)?
Modify: what have you changed in the code that will affect the outcome? 
Make: what have you made and what does it do? What real world problem does it solve?

Slide 8 - Tekstslide

Deze slide heeft geen instructies

Debugging!
Debugging comes from the process of fixing a system, program or solution that is not working as intended.
So, a person will "debug" a program breaking it down into smaller sections to identify the cause of the issues.

Slide 9 - Tekstslide

Deze slide heeft geen instructies

Copy and Run the following code
Go to: https://www.w3schools.com/python/trypython.asp?filename=demo_compiler
Copy and run my code then have a think about what might be the issue:


a = "It is"
b = "your turn"
c = "to
x = "tell"
y = "a"
z = "Story"
print(a, b, c, x, y, z)

Slide 10 - Tekstslide

Deze slide heeft geen instructies

Putting your 
detective hat on
When you run the code - the message returned is called a "stack trace" where it traced/followed all the responses from the computer similar to reading messages between you and your friends to find out what the issues are.
Can you see what this issue is?

Slide 11 - Tekstslide

Deze slide heeft geen instructies

What was wrong with the code?
a quotation mark is missing
too many apostrophes were added
an apostrophe is missing
too many quotation marks were added

Slide 12 - Poll

Deze slide heeft geen instructies

You do
Have a go at making your own story with the same structure but replacing the words:

a = "It is"
b = "your turn"
c = "to"
x = "tell"
y = "a"
z = "Story"
print(a, b, c, x, y, z)

Slide 13 - Tekstslide

Deze slide heeft geen instructies

You do too
Fix the following code (copy into the editor, run, debug and fix):
a = "It is"
b "your turn"
c = "to"
x = "tell",
y = "a"
z = Story"
print(a, b, c, x,, y, z)

Slide 14 - Tekstslide

Deze slide heeft geen instructies

I Do
Create your own list of variables like "a","b","c","x","y","z"
Assign them with a word.
Print out your words to tell a short story. 
Here is an example:
a = "My name is ..."
b = "I like ..."
print(a, b)

Slide 15 - Tekstslide

Deze slide heeft geen instructies

Next lesson
  • Exploring data types
  • Making your first game in Python called "Guess the Number"

Slide 16 - Tekstslide

Deze slide heeft geen instructies