Page 422 - CITS - Computer Software Application -TT
P. 422
COMPUTER SOFTWARE APPLICATION - CITS
This is a comment
written in
more than just one line
“””
print(“Hello, World!”)
As long as the string is not assigned to a variable, Python will read the code, but then ignore it, and you have
made a multi-line comment.
Variable
The word variable suggests that it is something that varies or changes.
A variable in Python is a container or storage box of which its contents can change depending on what we put
into the container or storage box.
It is a storage holder that has a name or label pasted outside it and it holds something of value inside it.
We can imagine a storage box with the label course_name and inside this storage box it contains the “Python
Course”.
The container’s label should match whatever is contained inside the container.
The container’s label should clearly and appropriately describe what will be stored inside the container.
80% of programming codes consist of containers, storage boxes, or variables because computers are so good at
storing things that change.
Creating Variables
When we create a variable, we give it a name it is like when we use a storage box, the first thing we do is to label
it with a name.
We use a variable name to reference data such that we can access the data inside the variable by referencing
the variable’s name.
The variable’s name is fixed but its content or value can change it is like now we put something into the storage
box and then further on we can take it out and put something else in.
Assigning Variables
To assign a value to a variable name, we use the assignment operator.
409
CITS : IT&ITES - Computer Software Application - Lesson 120 - 137 CITS : IT&ITES - Computer Software Application - Lesson 120 - 137