For loop (part 1)-6

 

list=["munna","shohan","soyeb","neon","rafiq"]


#list of list
list_of_list=[["munna khai lollypop",1],["shohan khai lollypop",2],
["shad khai lollypop",3],["shakil khai lollypop",4],
["neon khai lollypop",5],["azad khai lollypop",6]]


#this will print the list simply
for item in list :
print(item)

#this will print entire list_of_list
for item in list_of_list :
print(item)


#We can print tht seperatly devided by comma like ("munna khai lollypop"),(1 )
for item,lolly in list_of_list: #work- 2
print(item,"and",lolly)

print("\n")

#convert the list in dictionary
dictionary1=dict(list_of_list)
print(dictionary1)

#now we will do work- 2 with the help of dictionary

for item,lolly in dictionary1.items():
print(item ,"and",lolly)

#dictionary er just 1st item chaile
for item in dictionary1 :
print(item)

Comments

Popular posts from this blog

D WEB LINK