Twilight 3 - Python Introduction

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

This lesson contains 16 slides, with interactive quizzes and text slides.

Items in this lesson

Twilight 3 - Python Introduction

Slide 1 - Slide

This item has no instructions

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

What do these
have in common?

Slide 2 - Mind map

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

This item has no instructions

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

This item has no instructions

Orientation

Slide 5 - Slide

This item has no instructions

Deconstruction of the code

Slide 6 - Slide

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

Slide 16 - Slide

This item has no instructions