Produces a value Performs an action
Example: 5+3 Example: x = 5

---

11. Define the usage of indentation in Python.

Python uses indentation (spaces or tabs) to define blocks of code like loops, functions, and conditionals.

Example:

if x > 5:
    print("Greater")   # Indented block

---

12. List identity operators. Explain its use.

Identity operators:

is

is not

Used to check whether two variables refer to the same object in memory.

---

13. List membership operators. Explain its use.

Membership operators:

in

not in

Used to check whether a value exists in sequence.
Example:

3 in [1,2,3]   # True

---

14. Use of sep and end parameter in print().

sep → used to separate multiple values

end → used to specify what to print at the end (default: newline

)

Example:

print(1,2,3,,)

---

15. Define type conversion.

Type conversion means converting one data type into another.

Example:

int("20")   # string → int

---

------------------------------------------

📌 PART – B (6 MARKS EACH)

------------------------------------------

1. Illustrate the use of comments in Python with its types. (6 marks)

In Python, comments are used to describe code, make it readable, and to ignore lines during execution.

Python supports two types:

---

1️⃣ Single-Line Comments

Start with #
Example:

# This program prints Hello
print("Hello")

---

2️⃣ Multi-Line Comments

Enclosed within triple quotes (""" or ''').
Example:

"""
This is a program
to add two numbers
"""
a = 5
b = 10
print(a + b)

---

Importance of Comments:

Help understand code later

Useful during debugging

Documentation for other programmers

---

2. Differentiate between Tuple and List. (6 marks)

List Tuple

Mutable (can modify) Immutable (cannot change)
Created using [] Created using ()
Slower Faster
Suitable for frequent updates Suitable for fixed data

python Where stories live. Discover now