Workshop 8 Tasks on lists and tuples..¶

Task 1 Write a Python program that multiplies all the items in a list
Input:
2 4 6

Output:
48

In [ ]:
number_list = list(map(int, input().split()))


Task 2 Check if lists consist of the same elements
Input:
1 2 3 3 2
3 1 3 2

Output:
YES

Task 3 Write a Python program to split a list every Nth element
Input:
a b c d e f g h i j k l m n
5

Output:
a b c d e
f g h i j
k l m n

Task 4 Write a Python program to remove duplicates from a list
Input:
10 20 40 10 10 36 20

Output:
10 20 40 36

*Task 5 Write a Python program to generate all sublists of a list.
Input:
1 2 3

Output:
1
2
3
1 2
1 3
2 3
1 2 3

Task 6 Write a Python program to replace last value of tuples in a list (you don't need to get your list via input() command - just define it in your program):

Sample list: [(10, 20, 40), (40, 50, 60), (70, 80, 90)]
Expected Output: [(10, 20, 100), (40, 50, 100), (70, 80, 100)]

Task 7 Write a Python program to remove an empty tuple(s) from a list of tuples(you don't need to get your list via input() command - just define it in your program):

Sample data: [(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')]
Expected output: [('',), ('a', 'b'), ('a', 'b', 'c'), 'd']