0% found this document useful (0 votes)
16 views1 page

Python 2 Marks Important Questions

The document provides important 2-mark questions and answers related to Python programming. It differentiates between lists and tuples, defines a function, and explains lambda functions with examples. Key points include that lists are mutable and slower, while tuples are immutable and faster.

Uploaded by

sanjaygore802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Python 2 Marks Important Questions

The document provides important 2-mark questions and answers related to Python programming. It differentiates between lists and tuples, defines a function, and explains lambda functions with examples. Key points include that lists are mutable and slower, while tuples are immutable and faster.

Uploaded by

sanjaygore802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Programming - 2 Mark Important Questions with Answers

Q: Differentiate between List and Tuple


List and Tuple both store multiple items, but have key differences:

List:
- Mutable (can be changed)
- Defined using [ ]
- Slower due to flexibility

Tuple:
- Immutable (cannot be changed)
- Defined using ( )
- Faster and memory efficient

Example:
my_list = [1, 2, 3]
my_tuple = (1, 2, 3)

Q: Define a Function in Python


A function is a reusable block of code to perform a specific task.

Syntax:
def function_name(parameters):
# code block

Example:
def greet():
print("Hello")

Q: Explain Lambda Function


A lambda function is an anonymous, one-line function.

Syntax:
lambda arguments: expression

Example:
square = lambda x: x*x
print(square(5)) # Output: 25

You might also like