Click here to Skip to main content
15,064,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if i write the code, i am getting like this, how do i make a dictionary with this data given?
{'robin Chennai':['laptop','mobile','books'],'sisku Mumbai':['books','watch'],'madhavi Bangalore':['laptop','white board','markers'],'sanjay Chennai':['books','printer','ipad'],'rampal Mumbai':['ipad','printer','watch']}
what i am getting,
robin chennai
laptop
mobile
books
sisku mumbai
books
watch
madhavi bangalore
laptop
white board
markers
sanjay chennai
books
printer
ipad
rampal mumbai
ipad
printer
watch


What I have tried:

n=int(input())
d={}
for i in range(n):
    g=str(input())
    print(g)
    m=int(input())
    for j in range(m):
        e=input()
        print(e)
Posted
Updated 5-Jan-21 3:49am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900