Python_Units_01_to_05_Detailed_Answers
Python_Units_01_to_05_Detailed_Answers
------------------------------------
1. Features of Python:
- Interpreted Language
- Dynamically Typed
- Extensive Libraries
- Object-Oriented
- Indentation
- Input/Output
- Comments
- String (str)
- Mapping (dict)
- Boolean (bool)
- None
------------------------------------
- Arithmetic: +, -, *, /, %, //, **
3. Loop Manipulation:
- pass: Placeholder
for i in range(5):
if i == 3:
break
print(i)
else:
print("Completed")
3. Lists:
- Syntax: [1, 2, 3]
4. Sets:
- Unordered, no duplicates
5. Dictionaries:
- Key-value pairs
6. Tuples:
- Ordered, immutable
7. Lists vs Tuples:
- Lists: mutable, slower, many methods
8. Lists vs Dictionaries:
- Lists: index-based
- Dictionaries: key-based
------------------------------------
1. Built-in Functions:
2. User-defined Function:
return a + b
3. Scope of Variables:
4. Module:
5. User-defined Module:
7. Standard Packages:
- NumPy: arrays
- Matplotlib: plotting
- Pandas: dataframes
8. User-defined Package:
------------------------------------
class Student:
self.name = name
- Hiding: __var
4. Inheritance:
- Simple and Multiple
- Custom codes