Python - Variables and Data types
Set your Learning Objectives to red.
We are going to save all of our work for this topic into a PowerPoint like we did in our assessment.
Save your PowerPoint as 'Programming 1'
If for any reason you cannot open Thonny then click on the link below to use an online version of Python called CodeSkulptor3. Just be aware that the lessons are based upon using python in Thonny however the code will be exactly the same.
You have two python options for completing todays lesson.
In class we are going to be using the Python tool called 'Thonny' This is an app on your computer so search for it in the search bar
In python if you want the user to input data into the program, you can use the input()function, this is another built in functions to help us put data into our program.
Let us now look at the the input method input().
Let's start with a simple input and create it in python.
Copy the code above into your python window.
Save the file name as input.
Run the code.
You should see this
In your Powerpoint put a screenshot of your code with an explanation of what it does.
...In order to get user input in python you need to use the input() function. This puts a prompt onto the screen to allow the user to enter data. If you want to use the data in your program you have to store it in a variable . The print function can then use the variable to output our user input to the screen .
Let's try another simple input and create it in python.
In your Powerpoint put a screenshot of your code.
Let's try getting the user to input a number in python.
Save the code name as 'input3'.
There is a problem with our answer, it should not be 83, it should be 11?
It has got something to do with changing data types, so check last weeks lesson.
Now that we can get the user to input values and turn them into numbers we could create a simple calculator program.
It might start something like this:
These are the symbols we use in python for multiply and divide * = Multiply and / = divide. You can find the * symbol above the number 8 on your keyboard and the / above the ?
Explain your answers in your Powerpoint next to a screenshot of your code
Lets look at the learning outcomes and decide which one best describes our current level of understanding :
Tick the one you feel is closest to your level