A variable is a named location in memory that is defined to store data when writing a program. you can think of variables as a container that holds data that can be changed later in the program.
you can use the assignment operator = to assign a value to a variable name like in the code below
price = 10 # we use the variable name price and assign it a value 10
myname = "kamal"
_my_name = "kamal"
2bridgeType = "truss"
load = 5
Load = 10
LOAD = 15
#non will be overwritten
for=10
if=15
def= "kamal"
Check the list of the reserved keywords by typing help(“keywords”) to the Python interpreter
load= 30
print(type(load)) #type in-built function to check the type assign to the variable
#Output is int
load = "KN"
print(type(load))
#output is str
All programs make operations on data and most of this data will be defined and stored using variables, hence we must understand the concept of using variables before we learn other things in our programming journey.
Originally published at https://engineerxp.com