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

Intermediate List

The document contains 8 questions that ask the reader to write Python programs to perform various operations on lists. These include iterating through two lists simultaneously in different orders, concatenating lists, adding lists index-wise, extending a nested list, removing elements from a list, removing duplicates from a list, counting elements within a range, and reversing a list.
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)
22 views2 pages

Intermediate List

The document contains 8 questions that ask the reader to write Python programs to perform various operations on lists. These include iterating through two lists simultaneously in different orders, concatenating lists, adding lists index-wise, extending a nested list, removing elements from a list, removing duplicates from a list, counting elements within a range, and reversing a list.
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

Intermediate

Q1. Given a two Python list. Write a program to iterate both lists simultaneously and display items
from list1 in original order and items from list2 in reverse order.
List1=[100,200,300,400]
List2=[1,2,3,4]
Output- 100 4
200 3
300 2
400 1

Q2. Concatenate two lists in the following order.

List1=[“Good” , “Night”]

List2=[“morning”, “Evevning”]

Output=[“Good morning”, “Good evening”, “night morning”, “night evening”]

Q.3 Write a program to add two lists index-wise. Create a new list that contains the
0th index item from both the list, then the 1st index item, and so on till the last
element. any leftover items will get added at the end of the new list.

list1 = ["M", "na", "i", "Bof"]

list2 = ["y", "me", "s", "fins"]

Output= My name is Boffins

Q4 You have given a nested list. Write a program to extend it by adding


the sublist ["h", "i", "j"] in such a way that it will look like the following list.

list1 = ["a", "b", ["c", ["d", "e", ["f", "g"], "k"], "l"], "m", "n"]

Expected Output: ['a', 'b', ['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l'], 'm', 'n']

Q5. Write a Python program to print a specified list after removing the 0th, 4th and
5th elements
List = ['Red', 'Green', 'White', 'Black', 'Pink', 'Yellow']
Expected Output : ['Green', 'White', 'Black']

Q6.Make a list by taking 10 input from user. Now delete all repeated elements of the list.
E.g.-
INPUT : [1,2,3,2,1,3,12,12,32]
Intermediate
OUTPUT : [1,2,3,12,32]

Q7. Write a Python program to count the number of elements in a list within a
specified range.(5-11)

List1=[1,2,3,2,1,3,12,12,32,64,60,67,22]

Q8. Write a programme to reverse the given list using loop.


list1 = [100, 200, 300, 400, 500]

You might also like