2.1 Python LIST Exercise
2.1 Python LIST Exercise
Input:
Expected output:
Input:
Expected output:
Input:
Expected output:
This is property of IOTA Academy and can’t be shared with outside people. Any breach to TnC of IOTA will lead to legal proceedings
1
4) Write a program to concatenate two lists in the following
order.
Input:
Expected output:
Input:
Expected output:
10 400
20 300
30 200
40 100
Input:
Expected output:
This is property of IOTA Academy and can’t be shared with outside people. Any breach to TnC of IOTA will lead to legal proceedings
2
7) Write a program to add a new item to the list at a specified
position.
Input:
list1 = [10, 20, [300, 400, [5000, 6000], 500], 30, 40]
Expected output:
[10, 20, [300, 400, [5000, 6000, 7000], 500], 30, 40]
Input:
list1 = ["a", "b", ["c", ["d", "e", ["f", "g"], "k"], "l"], "m", "n"]
sub_list = ["h", "i", "j"]
Expected Output:
['a', 'b', ['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l'], 'm', 'n']
Input:
Expected output:
This is property of IOTA Academy and can’t be shared with outside people. Any breach to TnC of IOTA will lead to legal proceedings
3
10) Write a program to remove all occurrences of a specific item
from a list.
- Given a Python list, write a program to remove all occurrences of item 20.
Input:
Expected output:
Good Luck!
This is property of IOTA Academy and can’t be shared with outside people. Any breach to TnC of IOTA will lead to legal proceedings