+ 3
Dictionaries python
Dictionaries are what ? Ordered or Unordered Like Lists are ordered And Sets are unordered
14 Answers
+ 2
I think after 3.7 they are ordered
+ 7
Hirani Pranav Values can be any type of object, but keys must be immutable. This means keys could be integers, strings, or tuples, but not lists, because lists are mutable. Dictionaries themselves are mutable, so entries can be added, removed, and changed at any time.
+ 6
Dictionary in Python is an unordered collection of data values, used to store data values like a map, which unlike other Data Types that hold only single value as an element, Dictionary holds key:value pair
+ 5
Hirani Pranav See from "data values like a map" I mean to say that dictionaries act like the map because it gives u the location of the values.
Example: {1: 'Python', 2: 'Java', 3: 'Go'}
Like here 1 is key of Python , 2 is key of Java and 3 is the key of Go.
+ 5
Hirani Pranav I hope it helped u out..
You're welcome ☺️👍🏻
+ 4
Dictionaries are unordered 🤗
+ 3
💖..₥łⱤ₳₵ⱠɆ..💖 yes 👍👍
+ 3
List=[ ]
#list is used when you still want to change the values of a variable, that why it's mutable the values can be changed
Dictionary={key:value}
#dictionary is used when you are dealing with key and value pair, for example if you want to assign the age of a person to that person, dictionary will be used, '{Lucas:22,joy:24,boy:19}'.it is unordered
Tuples=( )
#tuples is used when you don't want to change the values of a variable, that why it's immutable it can't be changed
#i hope this help✨
+ 3
💖..₥łⱤ₳₵ⱠɆ..💖
I got your ans that dictionaries are unordered
But a new question was generated
What means map in
"used to store data values like a map"
+ 2
💖..₥łⱤ₳₵ⱠɆ..💖
Ohh
I thought map function or something like that 😃
👍
Thank you
+ 2
💖..₥łⱤ₳₵ⱠɆ..💖
Yes, I understand that
All I wanted to say that
In dictionaries we assign value to specific keys and in lists we assign value to specific index
But the only difference is indexes have number so they are ordered but key are not always be number (sometimes strings or any other type also) so they cannot be ordered
In this way we can compare this two
+ 2
Dictionaries are same as english bor hindi dict.Dictionary in Python is an unordered collection of data values, used to store data values like a map, which unlike other Data Types that hold only single value as an element, Dictionary holds key:value pair
+ 1
Akshay Panwar
💖..₥łⱤ₳₵ⱠɆ..💖
Oladimeji Elijah
So we can say
In list we are using index numbers
Like that
In dictionaries we are using keys
List=['a','b','c']
Dict={0:'a',1:'b',2:'c'}
And keys are any immutable not just int numbers
Right?
0
-Dictionaries are unordered collection of data values.
-It is mutable
-It works on key value pairs