Lecture # 6 - Variables
Reserved Keywords. Variables. Arithmetic Operators.
Reserved Keywords in Python:
Reserved words (also called keywords) are defined with predefined meaning and syntax in the language. These keywords have to be used to develop programming instructions. Reserved words can't be used as identifiers for other programming elements like variables, functions, classes, etc. Following is the list of reserved keywords in python3.
Variables:
In Python, variables are used to store and manipulate data. Unlike some other programming languages, Python does not require explicit declaration of variables or their data types before they are used. Instead, variables are created automatically when they are first assigned a value.
Naming Convention:
Naming convention is a convention for naming things. Lowercase with words separated by underscores is the naming convention for variables in python. e.g. user_name
.
Example 1:
cgpa = 3.2
print("My current cgpa is:", cgpa)
Output:
Example 2:
name = "Abdullah"
print("My name is", name)
Output:
Arithmetic Operators:
Arithmetic operators are used with numeric values to perform common mathematical operations.