writing a python function Convert_Dict(A) (Refer RollNo_W9B_1.py )function which take a dictionary as an input and convert it into list of lists
def Convert_Dict(A):
'''
function which take a dictionary as an input
and convert it into list of lists
'''
lis_of_lists = []
for item in A:
lis_of_lists.append([item, A[item]])
return lis_of_lists
# Testing
test_dict = {'a':1, 'b':2, 'c':3, 'zz':99}
print(Convert_Dict(test_dict))
Comments
Leave a comment