Python Syntax: =============== Variables: ========== ==> is a name which is used to store values of any type. ==> Python is dynamically typed language because of this while defining the variable, we not required the datatype to specify before the variable name. Syntax for variable: Initialization: name-of-variable = value ==> The Variable can define in two ways: 1) Compile Time Definition ========================== ==> if a program want to execute with same value in variable for multiple number of times, then we can define the variable in compile time. a = 'Hi' # assignment print(a) print(type(a)) 2) Run Time Definition ====================== ==> when the program want to execute for several times with different value assignments for variable then we can define the variable as run-time. ==> to define the variable in run-time, input() can be used. Syntax for input(): variable-name = input("Some Text") a = input("Enter some value for variable a:") print(a) ==> input() always read the value as string/text format only. ==> to read any other type of value using input(), we should do the type casting or type conversion to the input(). ==> type casting/type conversion is simply convert the data from one form to another form. # a = input("Enter some value for variable a:") a = int(input("Enter a value for variable a:")) print(a) print(type(a)) # a = int(a) # Type conversion to the value # print(type(a)) # print(a) Note: ===== in Python, no declaration for the variable is required. because the python is dynamically typed language. ============================================================= Datatypes ========== ==> Datatype represents the type of the value can store in the variable. ==> can be classified into two types: 1) Primitive Datatypes ======================= ==> All fundamental datatypes of python are categorized into Primitive type. ==> The Primitive datatypes are: Number type ==> define with numerals integer type ==> class: int floating-point type ==> float complex type ==> complex Boolean Type ==> define with non-numeral values ==> bool String/Text Type ==> define with text ==> str ==> primitive types can store with only one value at the variable. 2) Non-primitive Datatypes ========================== ==> are used to store in variable with group of values ==> also called as "Collection Types" ==> The Non-primitive datatypes are: List Type ==> list Tuple Type ==> tuple Set Type ==> set Dictionary Type ==> dict Arrays Type ==> arrays Frozen Sets ==> frozenset Bytes ==> bytes Byte Array ==> bytearray Note: ==== All primitive and non-primitive datatypes are built-in types in python, means: for every datatype, in python there is a built-in class. Class ==> collection/group of values and methods.