Python Programming – Quick Exam Notes
Introduction to Python
• High-level, interpreted, object-oriented programming language.
• Created by Guido van Rossum in 1991.
• Popular for: web development, AI, data science, automation.
Features of Python
1. Simple & Easy to Learn → syntax close to English.
2. Interpreted → runs line by line, no compilation.
3. Cross-platform → runs on Windows, Mac, Linux.
4. Open Source → free to use.
5. Extensive Libraries → NumPy, Pandas, Tkinter.
Data Types
• int → whole numbers (e.g., 10, -5)
• float → decimals (e.g., 3.14)
• str → strings (e.g., 'Hello')
• bool → True/False
• list → ordered, mutable [1,2,3]
• tuple → ordered, immutable (1,2,3)
• dict → key-value pairs {'name':'Rajani'}
• set → unique items {1,2,3}
Variables & Identifiers
• Variable = name to store data.
• Rules:
- Must start with a letter/underscore.
- Cannot use keywords (if, while).
Example:
name = 'Python'
age = 20
Operators
• Arithmetic → +, -, *, /, %
• Relational → >, <, ==, !=
• Logical → and, or, not
Control Structures
Introduction to Python
• High-level, interpreted, object-oriented programming language.
• Created by Guido van Rossum in 1991.
• Popular for: web development, AI, data science, automation.
Features of Python
1. Simple & Easy to Learn → syntax close to English.
2. Interpreted → runs line by line, no compilation.
3. Cross-platform → runs on Windows, Mac, Linux.
4. Open Source → free to use.
5. Extensive Libraries → NumPy, Pandas, Tkinter.
Data Types
• int → whole numbers (e.g., 10, -5)
• float → decimals (e.g., 3.14)
• str → strings (e.g., 'Hello')
• bool → True/False
• list → ordered, mutable [1,2,3]
• tuple → ordered, immutable (1,2,3)
• dict → key-value pairs {'name':'Rajani'}
• set → unique items {1,2,3}
Variables & Identifiers
• Variable = name to store data.
• Rules:
- Must start with a letter/underscore.
- Cannot use keywords (if, while).
Example:
name = 'Python'
age = 20
Operators
• Arithmetic → +, -, *, /, %
• Relational → >, <, ==, !=
• Logical → and, or, not
Control Structures