Create a lit containing list, dictionary,tuple in Python

Question

A list can contain anything. So create a list with elements as list, dictionary and tuple

in progress 0
TheDataMonk 55 years 3 Answers 606 views Grand Master 0

Answers ( 3 )

  1. list_in_list=[1,2,3,4,5]
    dictionary_in_list = {“India”:”Delhi”,”Australia”:”Canberra”,”Canada”:”Toronto”}
    tuple_in_list = (“Apple”,”Mango”,”Orange”)
    Final_list=[list_in_list,dictionary_in_list,tuple_in_list]

  2. list=[1,2,3,4,5]
    Tuple=(‘a’,’b’,’c’,d’,’e’)
    dict=(‘a’:1,’b’:2,’c’:3,’d’:4,’e’:5)
    final_list=[list,Tuple,dict]

  3. list=[2,3,1,4,5]
    dict={‘Names’:[‘Ariana’,’Joey’,’Maria’,’Rachel’],’Scores_in_Maths’:[87,98,80,79]}
    tup=(5,3,6,8,2)
    f_list=[list,dict,tup]
    print(f_list)

Leave an answer

Browse
Browse