CBSE Class 11 Informatics Practices Question 30 of 66

Dictionary — Question 2

Back to all questions
2
Question

Question 2

What are the differences between strings and dictionary?

Answer
StringDictionary
A string is a sequence of characters enclosed in quotes.A dictionary is a collection of key-value pairs enclosed in curly braces {}.
It is immutable.It is mutable.
Strings are ordered collection of objects.Dictionaries are unordered collections of objects.
For example, "hello", '123' etc.For example, {1: 'a', 2 : 'b'} etc