Assessment of Sumit
Assessment of Sumit
# ASSESSMENT QUESTION 1
numbers = [5, 10, 15, 20, 25]
numbers.append(30)
numbers.pop(1)
numbers[-1] = 35
print("Length of the list:", len(numbers))
print("Updated list:", numbers)
# ASSESSMENT QUESTION
for i in range(len(names)):
print(names[i], "is", ages[i], "years old")
reversed_list = numbers[::-1]
# Filter out all even numbers from a given list using list
comprehension.
#Create a new list that contains only the words with more than 3
characters from an existing list of strings.
#Create a 3x3 matrix as a nested list and print each row on a new
line
# Create a 3x3 matrix (nested list)
matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
print(flat_list)
print(unique_numbers)
Question 13
list1 = [1, 2, 3, 4, 5]
list2 = [3, 4, 5, 6, 7]
common_elements = []
print(common_elements)