Augmented Assignment Operators
• Used to perform operation and assignment in
one step.
• Examples:
• a += 5 (a = a + 5)
• a -= 2
• a *= 3
• a /= 2
• a %= 2
Expression and Expression
Statement
• Expression:
• Combination of variables, values and
operators that gives a result.
• Expression Statement:
• An expression written as a complete line of
code.
• Example: x = 10 + 5
Type Conversion
• Type conversion means changing one data
type into another.
• Implicit Conversion:
• Done automatically by Python (int to float).
• Explicit Conversion:
• Done by programmer using int(), float(), str().
Input and Output in Python
• Input:
• Used to take data from user.
• Example: a = int(input())
• Output:
• Used to display result.
• Example: print(a)
Operator Precedence
• Operator precedence decides execution order.
• Order (High to Low):
• 1. ()
• 2. **
• 3. *, /, %
• 4. +, -
• 5. =
Expression
• Any valid Python code that returns a value.
• Examples:
• a+b
• x>y
• a and b
Evaluation of Expression
• Evaluation means calculating final result.
• Example:
• (10 + 2) * 3
• Step 1: 10 + 2 = 12
• Step 2: 12 * 3 = 36