PYTHON EXAM NOTES
1. History & Features of Python:
Python was created by Guido van Rossum in 1991. It is simple, readable, portable, open■source,
and supports multiple paradigms with a large standard library.
2. Python Variables:
Variables store data. Rules: start with letter/_ , no spaces, case■sensitive, no keywords.
Examples: age=20, name="Riya", price=99.5
3. Numeric Data Types:
int: 10, -5
float: 3.14, -9.8
complex: 3+4j, -2j
4. String Operations:
Concatenation (a+b), slicing (s[1:3]), comparison ("a"=="a").
5. Date & Time:
Use datetime module: [Link](), [Link](2024,5,20)
6. Lists vs Dictionaries:
List: ordered mutable collection → [10,20,30]
Dictionary: key■value pairs → {"name":"Amit", "age":20}
7. List Operations:
append(), insert(), remove(), slicing, len()
8. Operator Precedence:
(), **, *,/,%, +,-
Example: 10+5*2 = 20
9. Coding Blocks & Indentation:
Indentation defines scope. Example:
if x>10:
print("Big")
10. List Slicing:
nums[1:4], nums[::-1]
11. Tuples:
Immutable sequences.
t=(10,20); t[1]=5 → ERROR