- The need for variables in digital systems
- To be able to explain what the use of variables
- How to prompt the user for data and assign it to a variable.
- I understand what a variable is
- I know how to assign data to a variable
- I can use the input() function to captures user’s keyed in data.
Discuss with the person next to you what is the difference between Interactive Mode (SHELL) and Script Mode
(hint: we use one of these to write larger and more complex programs).
When you are on interactive mode if you click File then New Window you will open below script mode window.
Open your Python program from start button > all apps > Python 3.1 > select IDLE (Python GUI)
Write the below code in Script Mode, save it as hello.py and run it to see what happens.
Explain in your book what do you think “name”, “year” and “age” do in above code?
Complete below sentence in your book with your own words.
A variable is …
Edit your program further by adding a new variable which will be assign to users favourite food.
You need to create a new variable called favourite_food by asking an input from a user to enter their favourite food
and you need to write a new line to output with their name, “Ah, your favourite food is” …
Save it and then Run it (F5)
Task 6 – QUESTIONS … you have 2 minutes!
Answer below questions in your book. Make sure you write Task 6 (you do not need to write the each question)
Create a program in python that prompts the user for their name AND the names of their top 5 favourite films. Each film should be assigned to a separate variable. When run, the computer should output the following…