x = 10 name = "Alice"
int
float
str
bool
=
age = 25 # Integer pi = 3.14 # Float name = "John" # String is_student = True # Boolean
type()
print(type(age)) # Output: <class 'int'> print(type(name)) # Output: <class 'str'>
<class 'int'> <class 'str'>
x = 10 y = 5 sum = x + y # Addition product = x * y # Multiplication
+
-
*
/
%
price = 19.99 discount = 0.10 total = price * (1 - discount)
message = "Hello, world!" name = 'Alice'
greeting = "Hello, " + name
laugh = "ha" * 3 # Output: "hahaha"
first_letter = name[0] # Output: 'A'
True
False
is_adult = True has_permission = False
None
result = None
x = 10 # int y = float(x) # Converts to float: 10.0 z = str(x) # Converts to string: '10'
age = 30 message = "I am " + str(age) + " years old." print(message) # Output: I am 30 years old.
I am 30 years old.