Print function
Whenever you want to display something on the screen,
you must use the print command. You must ALWAYS
open and close the BRACKETS.
Variables
Value
film = “Frozen”
print (film)
Create a Displays the
variable value of the
called film variable.
which stores a
value.
Variables
Value
Create a Displays the
variable called value of the
number which variable.
stores a value.
Hint: You DO NOT need Quotation mark when storing
numbers in a variable.
The quotation marks are only needed for a string or
char
Variables
In python, we can use the comma “,” to concatenate
(join things together).
film = “Lion King”
print (“My favourite film is” , film)
What will the above program display?
My Favourite film is Lion King.
Variables & Constants
What will this program display?
film = “Lion King”
print (“My favourite film is” , “film”)
My favourite film is film
You must NOT put quotation marks around
variables.
Input function
Displays the
user’s answer The
question
Displays the
Variable called user’s answer
“name”
The above code will ask the user to enter their
name. Then it will wait until the user enters their
name.
Input function
Displays the
user’s answer The
question
Displays the
Variable called user’s answer
“name”
This is what the program will display if you
enter Martin.
Input function
Displays the
user’s answer The
question
Variable called
“name”
What will the program display if you enter Martin.
Your name is Martin
Tasks
Complete task 1-7. Use the hint to help
you.
Then complete the extension task.
1. Display the following on 4 separate lines:
• I like Snapchat Hint:
• I like Instagram
• I like Twitter
• I love Facebook
Paste your code below:
Extension:
Display your name, your age and your gender on 3 separate lines.
Paste your code below:
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.
Paste your code below:
Hint:
3) Ask the user for their favourite film. Display “I also like
watching”, film. Hint
Paste your code below:
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:
Paste your code below:
5. Create a program that ask the user for their name. Display the
name 1000 times. Use * to multiply.
Hint:
Example:
Paste your code below:
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:
Paste your code below:
7. Ask the user for their name and favourite hobby. Display “your
name is”, name, “and your favourite hobby is”, hobby. Example:
Paste your code below:
Extension
Homework
Complete the extension tasks (task 8 and 9) if you’ve
finished the previous questions.
8. Ask the user for a username. Then display “Welcome”, username.
Paste your code below:
9. Ask the user to enter a random symbol such as #. Then display
that symbol 100 times.
Paste your code below: