0% found this document useful (0 votes)
4 views7 pages

Python

The document explains augmented assignment operators in Python, which allow for operations and assignments in one step, such as 'a += 5'. It also covers expressions, expression statements, type conversion (implicit and explicit), input/output methods, operator precedence, and the evaluation of expressions, providing examples for clarity. Overall, it serves as a concise guide to fundamental Python programming concepts.

Uploaded by

nishant9708741
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

Python

The document explains augmented assignment operators in Python, which allow for operations and assignments in one step, such as 'a += 5'. It also covers expressions, expression statements, type conversion (implicit and explicit), input/output methods, operator precedence, and the evaluation of expressions, providing examples for clarity. Overall, it serves as a concise guide to fundamental Python programming concepts.

Uploaded by

nishant9708741
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like