Code: Select all
# Addition
result_add = 10 + 5 # Result: 15Code: Select all
# Subtraction[/size]
result_subtract = 20 - 8 # Result: 12Code: Select all
# Multiplication
result_multiply = 7 * 4 # Result: 28Code: Select all
# Division
result_divide = 15 / 3 # Result: 5.0 (float division)Code: Select all
# Floor Division
result_floor_divide = 15 // 4 # Result: 3 (integer division)Code: Select all
# Modulus (Remainder)
result_modulus = 20 % 3 # Result: 2Code: Select all
# Equal to
is_equal = (5 == 5) # Result: TrueCode: Select all
# Not equal to
not_equal = (10 != 5) # Result: TrueCode: Select all
# Greater than
greater_than = (15 > 10) # Result: TrueCode: Select all
# Less than
less_than = (8 < 12) # Result: TrueCode: Select all
# Greater than or equal to
greater_than_equal = (20 >= 20) # Result: TrueCode: Select all
# Less than or equal to
less_than_equal = (7 <= 9) # Result: TrueCode: Select all
# Logical AND
logical_and = (True and False) # Result: FalseCode: Select all
# Logical OR
logical_or = (True or False) # Result: TrueCode: Select all
# Logical NOT
logical_not = not True # Result: FalseCode: Select all
# Assignment
x = 10Code: Select all
# Increment
x += 5 # Equivalent to x = x + 5Code: Select all
# Decrement
x -= 3 # Equivalent to x = x - 3Code: Select all
# Multiplication assignment
x *= 2 # Equivalent to x = x * 2Code: Select all
# Assignment
x = 10Code: Select all
# Increment
x += 5 # Equivalent to x = x + 5Code: Select all
# Decrement
x -= 3 # Equivalent to x = x - 3Code: Select all
# Multiplication assignment
x *= 2 # Equivalent to x = x * 2