Answer to Question #298660 in Python for Sudheer

Question #298660

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

1
Expert's answer
2022-02-16T13:24:38-0500
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS