1. Created by Mr Suffar
Monday, August 28, 2023
Lesson objectives…
Understand how to setup Python IDLE.
Use the print and input functions successfully.
Explain the purpose of variables & constants.
Python Introduction
Lesson 1
2. Created by Mr Suffar
Video
https://youtu.be/KLcPJQPwTjU
You can either use Python IDLE or web browser based
python (repl it) on: https://repl.it/languages/python3
Setting up your IDE
3. Created by Mr Suffar
Starter activity
• Create a folder in your area
named: Python.
• Create another folder inside the
Python folder and name it:
Lesson 1.
• Open IDLE Python. Click on FILE
New FILE.
Python Shell
Editor
Window
Python Introduction
4. Created by Mr Suffar
• Click on options > Configure
IDLE
• Change the font size to 25 and
tick BOLD then click APPLY
then click on OK
Python Introduction
5. Created by Mr Suffar
• Click on options > Configure
IDLE
• Click on GENERAL then click
on Open Edit Window then
click on APPLY and press OK.
Python Introduction
6. Created by Mr Suffar
Video
https://www.youtube.com/watch?v=HY7roHmN8vo
Lesson 1 - Theory
7. Created by Mr Suffar
Print function
Whenever you want to display something on the screen,
you must use the print command. You must ALWAYS
open and close the PARANTHESIS.
8. Created by Mr Suffar
Syntax error
Syntax: The order of instructions or commands.
Syntax Error: When you break the rules of the
programming language.
Examples:
• Print(“Welcome Tom”)
• print(“Football”
• print(Dancing)
9. Created by Mr Suffar
Complete task 1. Use the hint to help you.
10. Created by Mr Suffar
Print function
1- Type the following in python:
2- Press F5 to run the program.
3- Create a program that displays your name, your
country and date of birth on the screen on separate
lines. Hint: Use 3 print commands.
11. Created by Mr Suffar
Variables & Constants
Variable: A location in a
memory where data is
stored. It can be changed
while the program is
running.
Constant: A location in a
memory where data is
stored. It cannot be
changed while the program
is running.
12. Created by Mr Suffar
film = “Frozen”
print (film)
Assign film as
a variable
which stores
a value.
Displays the
value of the
variable.
Value
Variables & Constants
13. Created by Mr Suffar
• Hint: You DO NOT need Quotation mark when
storing numbers in a variable.
Assign film as
a variable
which stores
the value.
Displays the
value of the
variable.
Value
Variables & Constants
14. Created by Mr Suffar
film = “Lion King”
print (“My favourite film is” , film)
Concatenation: Joining things together.
In python, we can use the comma “,” to concatenate.
Variables & Constants
What will the above program display?
My Favourite film is Lion King.
15. Created by Mr Suffar
film = “Lion King”
print (“My favourite film is” , “film”)
What will this program display?
Variables & Constants
My favourite film is film
You must NOT put quotation marks around
variables.
16. Created by Mr Suffar
• The above code will ask the user to enter
their name. Then it will wait until the user
enters their name.
Variable called
“name”
Displays the
user’s answer
The
question
Input function
Displays the
user’s answer
17. Created by Mr Suffar
• This is what the program will display if you
enter Martin.
Variable called
“name”
Displays the
user’s answer
The
question
Input function
Displays the
user’s answer
18. Created by Mr Suffar
• What will the program display if you enter Martin.
• Your name is Martin
Variable called
“name”
The
question
Input function
Displays the
user’s answer
19. Created by Mr Suffar
Python Introduction
hobby = imput(“Enter a hobby”)
print (hobby)
Syntax errors occurs when you break the
rules of the programming language.
Identify the syntax error in the code above:
• imput should be changed to input.
20. Created by Mr Suffar
Complete task 1-7. Use the hint to help
you.
Then complete the extension task.
Tasks
21. Created by Mr Suffar
1. Display the following on 4 separate lines:
• I like Snapchat
• I like Instagram
• I like Twitter
• I love Facebook
Extension:
Display your name, your age and your gender on 3 separate lines.
Hint:
https://youtu.be/3G9LW5CGa7Y
22. Created by Mr Suffar
2. Create a variable called food and store your favourite food
inside the variable. Print out the value of the variable onto the
screen. YOU DO NOT NEED AN INPUT COMMAND.
Hint:
https://youtu.be/Kf5w5MhO_t8
23. Created by Mr Suffar
3) Ask the user for their favourite film. Display “I also like
watching”, film. Hint
https://youtu.be/V3GIhjCrnm0
24. Created by Mr Suffar
4. Create a program that ask the user for their hobby, surname, favourite colour
and favourite pet. Display the above on 4 separate lines. “Remember you can’t
have space in a variable name.
Hint:
https://youtu.be/Ru34WIgnZ08
25. Created by Mr Suffar
5. Create a program that ask the user for their name. Display the
name 1000 times. Use * to multiply.
Example:
Hint:
https://youtu.be/fZEUPpQ6gNQ
26. Created by Mr Suffar
6. Create a program that ask the user for their favourite food.
Display “I also like”, food. Food should be replaced with the user’s
answer. hint:
https://youtu.be/hpCJTgMdTb0
27. Created by Mr Suffar
7. Ask the user for their name and favourite hobby. Display “your
name is”, name, “and your favourite hobby is”, hobby. Example:
https://youtu.be/fr7nBwIEsOs
28. Created by Mr Suffar
Homework
Complete the extension tasks (task 8 and 9) if you’ve
finished the previous questions.
Extension
29. Created by Mr Suffar
8. Ask the user for a username. Then display “Welcome”, username.
https://youtu.be/PIdZZSV9jVU
30. Created by Mr Suffar
9. Ask the user to enter a random symbol such as #. Then display
that symbol 100 times.
https://youtu.be/UvsF0Nx5rYs
31. Created by Mr Suffar
Homework
Video of data types: https://youtu.be/ka3nBNi-j9M
Editor's Notes
Shell runs single instructions
Editor allows you to save and then go back and edit programs at later points
Shell runs single instructions
Editor allows you to save and then go back and edit programs at later points
Shell runs single instructions
Editor allows you to save and then go back and edit programs at later points
Shell runs single instructions
Editor allows you to save and then go back and edit programs at later points
Shell runs single instructions
Editor allows you to save and then go back and edit programs at later points
Demonstrate first example, ask students to explain second example, and now ask them to carry on with the task sheet.
Demonstrate first example, ask students to explain second example, and now ask them to carry on with the task sheet.