KnowledgeBoat Logo
|

Informatics Practices

What are the differences between strings and dictionary?

Python Dictionaries

2 Likes

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

Answered By

1 Like


Related Questions