Sep 25, 2024
Integer
x = 10
, y = 5
Float
a = 3.14
, b = -75
x = 3e-10
for 3x10^(-10)).Complex
j
.c = 2 + 3j
, d = -1 + 4j
type()
function to check variable types.number_one = 15
returns <class 'int'>
number_two = -3.57
returns <class 'float'>
number_three = 3 + 4j
returns <class 'complex'>
name_1 = "Par Roy"
or name_2 = 'Par Roy'
+
to join strings, e.g., name_3 = name_1 + name_2
.*
to repeat strings, e.g., name_3 * 2
.name_3[0]
returns P
, name_3[1]
returns second character.True
or False
.x > y
, x == 5
int
to float
during operations.int()
, float()
, etc.
number_3 = int(number_2)
converts float to int.