1.

List one similarity and one difference between List and Dictionary datatype.

Answer»

Similarity: Both List and Dictionary are mutable datatypes.

Dissimilarity: List is a sequential data type i.e. they are indexed.

Dictionary is a mapping datatype. It consists of key: value pair.

Eg: L =[1,2,3,4,5] is a list

D= {1:”Ajay”,2:”Prashant,4:”Himani”} is a dictionary where 1,2,4 are keys and “Ajay”,Prashant,”Himani” are their corresponding values.



Discussion

No Comment Found

Related InterviewSolutions