Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views2 pages

List Ws 11 Ip

The document contains a series of fill-in-the-blank questions, answers, and practical programming tasks related to Python lists. It covers list characteristics, methods for manipulating lists, and coding exercises for various mathematical and string operations. The content is structured into sections A, B, and C, focusing on definitions, comparisons, code outputs, and practical applications.
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)
6 views2 pages

List Ws 11 Ip

The document contains a series of fill-in-the-blank questions, answers, and practical programming tasks related to Python lists. It covers list characteristics, methods for manipulating lists, and coding exercises for various mathematical and string operations. The content is structured into sections A, B, and C, focusing on definitions, comparisons, code outputs, and practical applications.
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/ 2

Section A

Fill in the blanks:


1. List in Python is classified as ___________ data type.
2. A list consists of elements of ______________ type.
3. Elements of a list are enclosed in ____________ brackets.
4. Lists are _____________, you can update or edit the list.
5. ____________ method is used to delete elements from a list if index is
not known.
6. ____________ method is used to delete elements from a list if index is known.
7. The ___________ method adds a single item to the existing list at the end.
8. You can compare two lists by using ___________ operators.
9. The ___________ operator replicates a list.
10. The __________ function arranges of a list in an ascending or descending
order.
Section B
Answer the following:
1. What is a list?
2. What is the difference between append() and extend()?
3. What is the difference between pop() and remove()?
4. Write the most appropriate list method to perform the following
tasks:
(a) Delete a given element from the list :
(b)Get the position of an item in the list :
(c) Delete the 3rd element from the list:
(d)Add single element at the end of the list :
(e) Add an element in the beginning of the list :
(f) Add elements at the end of the list :
Section C
Find the output of the following code:
(a) List1 = [5, 10, 15, 20, 25, 50, 20]
K = List1.index(20)
List1[ k ] = 250
print(List1)

(b) L = [2, 4, 5, 6, 2, 3, 4, 4, 7]
Count = L.count(4)
print(Count)

(c)L2 = [10, 45, 2, 20, 30, 40]


L2.sort()
print(L2)
L2.reverse()
print(L2)
(d)L1 = [500, 600]
L2 = [150, 275, 400]
print(L1 + L2)
L1.append([700,750])
L1.append(800)
print(len(L1))
print(L1)
print(L1.index(800))
(e) L3 = [35, 45]
print(L3 * 3)
L3.extend([50,75,80])
print(len(L3))
print(L3)
(f) List1 = [20, 40, 30, 50, 60, 40, 50, 30, 10, 20, 60, 30]
print(List1.pop(1))
print(List1.pop())
print(List1.count(30) * List1.count(60))
(g) What does each of the following expressions evaluate to? Suppose that
L is the list
L=["These", ["are", "a", "few", "words"], "that", "we", "will", "use"].
(a) L[1][0::2]
(b) "a" in L[1] [0]
(c) L[:1] + L[1]
(d) L[2: :2]
(e) L[2][2] in L[1]

Practical Programs (To be done in your record notebook)


1. To find average and grade for given marks.
2. To find sale price of an item with given cost and discount (%).
3. To calculate perimeter/circumference and area of shapes such as triangle,
rectangle, square and circle.
4. To calculate Simple and Compound interest.
5. To calculate profit-loss for given Cost and Sell Price.
6. To calculate EMI for Amount, Period and Interest.
7. To calculate tax - GST / Income Tax.
8. To find the largest and smallest numbers in a list.
9. To find the third largest/smallest number in a list.
10. To find the sum of squares of the first 100 natural numbers.
11. To print the first ‘n’ multiples of given number.
12.To count the number of vowels in user entered string.
13.To print the words starting with an alphabet in a user entered string.
14.To print number of occurrences of a given alphabet in each string.

You might also like