Python Answers
Python Answers
1. Encapsulation
2. Inheritance
3. Polymorphism
4. Abstraction
1. int
2. float
3. str
4. list
3. What will be the output of the following code for `i in range(2, 5)`?
Syntax:
if condition:
# code block
else:
# code block
6. What is a mode in Python and explain any two modes of opening a file.
Example:
`x = 5` (integer)
`x = 'Hello'` (string)
numbers = [2, 4, 1, 3, 5]
print(numbers[=2.0=1])
The code is incorrect and will raise a SyntaxError due to invalid index expression.
10. Define the `is` operator and the assignment operator in Python.