Primitive Datatypes: ==================== Number Type: ============ 1) Integer datatype: class: int Decimal form ==> base-10 ==> 0 to 9 Binary form ==> base-2 ==> 0 or 1 ==> 0b/0B Octal form ==> base-8 ==> 0 to 7 ==> 0o/0O Hexadecimal form ==> base-16 ==> 0 to 9 and A/a to F/f ==> 0x/0X a = 123 # decimal b = 0b11001 # binary c = 0o1275 # octal d = 0xaf12 # hexadecimal print(type(a)) print(type(b)) print(type(c)) print(type(d)) 2) Floating-point datatype: =========================== class: float can define in two ways: 1) using decimal point ======================== 123.234 before the decimal point ==> decimal part after the decimal point ==> fractional part ==> Floating-point values always define with decimal literals only. a = 123.234 # b = 0b11001.110 # b = 0o1762.234 # b = 0X1122.12 print(type(a)) 2) using scientific/exponential values ======================================= Scientific number 1.23 X 10^30 ==> 123/100 X 10^30 ==> 123 X 10^-2 X 10^30 ==> 123 X 10^28 ==> 123e28 # a = 1.23 * 10^30 a = 123e28 b = 1.23E27 c = 130e24 d = -1234E-300 print(type(a)) print(type(b)) print(type(c)) print(type(d)) Here: mantissa ==> group of digits before the letter 'e' exponent ==> group of digits after the letter 'e' Note: ==== 1) Mantissa can allow with decimal value/float value. But exponent always be with decimal value only. 2) Mantissa and exponent can either positive or negative. 3) Complex Type: ================= ==> class: complex ==> complex number is the combination of real number and imaginary number. Syntax: real-number +/-imaginary-number Here: imaginary-number can always suffix with 'j' ==> Real part of complex number ==> decimal/binary/octal/hexadecimal where as the imaginary part ==> with decimal only ==> Real and Imaginary numbers from complex ==> can be float also. a = 10 + 20j # real == +eve decimal and imag == +eve decimal b = -10 - 20j # real == -eve decimal and imag == -eve decimal # c = 0O11001 - 0o100j c = 1.23 + 2.34j d = 123e-7 - 0.001e7j print(type(a)) print(type(b)) print(type(c)) print(type(d)) ========================================== Boolean Type: ============= ==> Non-numerical type ==> Boolean data can define with only two values: True (Keyword) False (Keyword) ==> class: bool ==> PVM can understand Boolean values as 1 and 0 True ==> 1 False ==> 0 a = True b = False print(type(a)) print(type(b)) print(a + a + b ) print(a - a) ================================== String Type: ============ ==> String can be defined as group of characters which enclosed with single quote/double quote. Ex: 'Python', "java" a = 'A' b = 'python' c = "B" d = "Java" print(type(a)) print(type(b)) print(type(c)) print(type(d))