Search Header Logo
Python- Getting to know the language

Python- Getting to know the language

Assessment

Presentation

•

English

•

8th Grade

•

Easy

Created by

Vasantha Ponnen

Used 8+ times

FREE Resource

23 Slides • 5 Questions

1

media

Lesson 1: Getting to know the language

Year 8 – Intro to Python programming

2

3

media

Starter activity

Can you follow these instructions?

Align the two strips
at one end.

Cut the longer strip
where the shorter
strip ends.

Discard the part that
you have cut off that is
the same length as the
shorter strip.

Repeat

to

until the strips are
equal in length.

Measure that length
and report it — it’s
the required result.

a

b

c

a

c

You have two strips of paper. One is X cm long, the other is Y cm long.

4

media

Unit objectives

●Used a block-based programming
language (Scratch) to create
programs that involved:

○Variables, operators, and
expressions

○Sequence, selection, and iteration

○Subroutines

○Lists

In the previous units, you...

In this unit, you will...

●Use a text-based programming
language (Python) to build on
these concepts and extend
them

print("Hello Python!")

5

media

Objectives

I can explain keywords in python in my own
words
- Program, Algorithm, Syntax
I can write my first function in python
I can create my own function using examples

In this lesson, you will...

6

media

Activity 1

Algorithms

An algorithm is a set of precise
instructions, expressed in some sort
of language (e.g. textual, visual).

Understanding the language is
necessary in order to execute the
instructions.

Executing these instructions is meant
to solve a problem.

7

media

Activity 1

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.

8

media

Activity 1

Python programs

To execute a Python program, you
need a Python interpreter.

This is a program that translates and
executes your Python program.

The Python interpreter doesn’t necessarily run
on your computer.

9

media

Activity 1

Syntax

All languages have rules for syntax,
i.e. how sentences can be assembled.

Speech or text in a language must
follow its syntax.

Humans can infer meaning even in
cases when syntax rules are violated.

For example, “tonigth see you”, instead of “see
you tonight”, will probably be understood.

All programming languages have
rules for syntax, i.e. how statements
can be assembled.

Programs written in a programming
language must follow its syntax.

Programs with syntax errors cannot
be translated and executed.

10

media

Activity 1

Syntax

In Scratch, syntax errors are not
possible: rules are enforced by the
blocks and the way they fit together.

All programming languages have
rules for syntax, i.e. how statements
can be assembled.

Programs written in a programming
language must follow its syntax.

Programs with syntax errors cannot
be translated and executed.

You can still make logical errors !
That’s when your program doesn’t
work the way it should.

11

media

Syntax

Activity 1

In Python, you can (and you will)
make syntax errors. You will need to
follow the syntax rules.

All programming languages have
rules for syntax, i.e. how statements
can be assembled.

Programs written in a programming
language must follow its syntax.

Programs with syntax errors cannot
be translated and executed.

Syntax errors can be frustrating when you start
learning a text-based programming language.

if remaining < 10:

print("We are getting there")

else:

print("Still some way to go")

12

media

Syntax

Activity 1

SyntaxError: invalid syntax

SyntaxError: Missing parentheses in
call to 'print'.

SyntaxError: EOL while scanning string
literal

Has this happened to
YOU?

Don’t be overwhelmed by these
errors. They are here to discourage
the faint-hearted. You can fix them!

13

media

Your first steps in Python

Activity 2

Every time you learn a new
programming language,
it’s a tradition to get your first
program to say “hello”.

print("Hello world!")

14

Multiple Choice

An  algorithm  is a set of precise instructions designed to solve a problem.

1

True

2

False

15

media

Activity 2

Your first steps in Python

Complete the first task in your
worksheet to create your own ‘Hello
world’ program.

16

media

print("Hello world!")

Your first steps in Python: commentary

Activity 2

Have you used (single or double) quotation
marks around the message to be displayed?

Have you used (opening and closing) round
brackets around the message to be displayed?

Checklist:

Have you spelt print correctly?
Python is case-sensitive: using capitals makes a
difference.

✔

✔

✔

17

media

print("Hello world!")

Your first steps in Python: commentary

Activity 2

You will need the print function:

when your program must display text, numbers,
or the values of variables and expressions.

18

Multiple Choice

Question image

What will happen when this code is run?

1

Nothing there is an error on line 2

2

It will print the following:

Hello World!

Oh, you are a wally

3

It will print the following:

"Hello World!"

Then wait for next instruction

4

Nothing, there is no instruction given to the user.

19

Multiple Choice

What print(" ") function does?

1

Prints values in the program

2

Prints whats inside the quotation

3

Prints a copy of the code

4

Pints a pdf throught a printer

20

media

Activity 2

Your first steps in Python

Complete the second task in your
worksheet to greet the user by
name.

21

Multiple Choice

Python is the fastest growing programming language:

1

True

2

False

22

media

user = "Claude"
print("Hello", user)

Your first steps in Python: commentary

Activity 2

user is a variable, i.e. a name for a value.

The variable user currently refers to the value
"Claude".

The quotation marks around the value show the
type of the value: it is a string (a piece of text).

You will need an assignment statement:

when your program must use a name
(an identifier) to keep track of a value.

23

media

Activity 2

Your first steps in Python

Complete the third task in your
worksheet.

24

media

user = "Claude"
print("Hello", user)

lucky = 13
print("My lucky number is", lucky)

Your first steps in Python: commentary

Activity 2

lucky is another variable.
It is assigned an integer value.

It is useful to sketch variables and their
corresponding values, as they change
during program execution.

user

"Claude"

lucky

13

user is a variable.
It is assigned a string value.

25

media

Activity 2

Your first steps in Python

Complete the final task in your
worksheet, to make your program
receive input from the user.

26

media

print("What’s your name?")
user = input()
print("Hello", user)

Your first steps in Python: commentary

Activity 2

The text typed by the user is assigned to the
user variable.

When input is invoked, the program pauses,
waiting for keyboard input.

We can refer to the value of user in the
program without knowing what it will be.

You will need the input function:

when your program must receive keyboard
input from the user.

27

media

print("Best film ever?")
film = input()
print(film, "is my favourite too!")

Python recap

Activity 3

●Display a message for the user
on the screen

Locate the fragment(s) of code that:

●Retrieve what the user types on
the keyboard

●Assign a value to a variable

28

Multiple Choice

Text to be output to the screen should be enclosed by " "

1

True

2

False

pattern-tertiary
media

Lesson 1: Getting to know the language

Year 8 – Intro to Python programming

Show answer

Auto Play

Slide 1 / 28

SLIDE