0% found this document useful (0 votes)
11 views

LabAssignment 4A Lists

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

LabAssignment 4A Lists

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LAB EXERCISE: 4 (A)

LISTS

Work From Home:

Q.1 Practice the following codes to understand List Comprehensions (ways to create lists),
indexing and slicing.
Q.2 Create at least one example of the following list methods.
List.append(), list.insert(), list.remove(), list.extend(), list.count(), list.index(), list.reverse(),
list.sort(), list.pop(), list.clear(), list.copy()
Work During the LAB:
Q. 3 Given a = [1, 2, 3, 5, 7, 13]. Do the following operations with a using at least two
different methods/codes:
a. Add 17 as the last element in a
b. Insert 9 between 7 and 13
c. remove 1 and the 4th lement in a
d. Create another least of square of all the numbers
e. Sum all the numbers in the list a. (Implement with and without function)
f. Find the maximum number in the list
g. Count the number of elements not divisible by 2 and 3 both.

Q.4 Given sList = [“pen”, “pencil”, “notepad”, “crayons”, “water colour”, “markers”].
Write a code to achieve the following outcome:
a. Find the total number of items
b. Find the strings with length greater than 6

Q.5 Given two lists: a = [1, 3, 5, 7, 9, 11, 13] and b = [3, 6, 9, 12, 15]. Write a code to find
common elements from the both.
Hint: Take each element from list a and verify whether a copy exists in the list b or not.

Q.6 Take 6 input numbers one-by-one and create a list using them. Then, do the following
operations:
a. Print the numbers in the same order they were input
b. Print the numbers in the reversed order, i.e., the last input should be
output first

You might also like