Objectives
Simple examples:
2 + 3 # evaluates to 5
x * 10 # evaluates to the value of x multiplied by 10
"Hello" + " World" # evaluates to "Hello World"
More complex examples:
(x + y) / 2
len("Python") > 5
Examples of instructions:
x = 5 # Assignment instruction
print(x) # Display instruction
if x > 0: # Conditional instruction
print("Positive")
2 + 3, x - 1x > 5, y == 0"Hello" + "World"y = (x + 5) * 2 # Expression (x + 5) * 2 used in an assignment instruction
x = 10if, for, whiledef my_function():import math- Simple instructions: A single line of code, for example `x = 10.`
- Compound instructions: Consist of multiple lines of code and include a code block (for example, loops and conditions).
if (x + 5) > 10: # The expression (x + 5) > 10 is used to test the condition
print("The condition is true.")