dict={'pig':1,'monkey':1,'panda':1,'tree':2,'melon':2,'flower':2} lst1=[] lst2=[] forkey,valueindict.items(): ifvalue==1: lst1.append(key) elifvalue==2: lst2.append(key) print(lst1) print(lst2)
dict={'pig':1,'monkey':1,'panda':1,'tree':2,'melon':2,'flower':2} lst1=[] lst2=[] forkey,valueindict.items(): ifvalue==1: lst1.append(key) elifvalue==2: lst2.append(key) print(lst1) print(lst2)