

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Python for Beginners 2026-2027, Home Assignment
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Que. 1: Explain List Data Type and it’s methods with suitable example. (10 Marks) What is a List? In Python, a List is a built-in data type used to store multiple items in a single variable. Lists are created using square brackets []. Key Features: Ordered: Items have a defined order that will not change. Mutable: You can change, add, or remove items after the list is created. Allows Duplicates: Lists can have two items with the same value. Common List Methods
fruits = ["apple", "banana", "cherry"]
fruits.append("mango")
fruits.insert(1, "orange")
fruits.remove("apple") print(fruits)
Que. 2: What is function in Python? Explain with suitable program code. (05 Marks) What is a Function? A Function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. You define a function using the def keyword. A function only runs when it is called. Program Code Example:
def greet_user(name): """This function greets the person passed in as a parameter""" print("Hello, " + name + ". Welcome to Python programming!")
greet_user("Amit") greet_user("Sita")