+ 3

Dictionaries python

Dictionaries are what ? Ordered or Unordered Like Lists are ordered And Sets are unordered

7th May 2021, 11:20 AM
Pranav Hirani
Pranav Hirani - avatar
14 Antworten
+ 2
I think after 3.7 they are ordered
28th Jan 2022, 7:56 PM
Pranav Hirani
Pranav Hirani - avatar
+ 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.
7th May 2021, 2:39 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 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
7th May 2021, 11:24 AM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 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.
7th May 2021, 11:53 AM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 5
Hirani Pranav I hope it helped u out.. You're welcome ☺️👍🏻
7th May 2021, 11:56 AM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 4
Dictionaries are unordered 🤗
7th May 2021, 11:23 AM
Akshay Panwar
Akshay Panwar - avatar
7th May 2021, 11:25 AM
Akshay Panwar
Akshay Panwar - avatar
+ 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✨
7th May 2021, 11:51 AM
Oladimeji Elijah
Oladimeji Elijah - avatar
+ 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"
7th May 2021, 11:52 AM
Pranav Hirani
Pranav Hirani - avatar
+ 2
💖..₥łⱤ₳₵ⱠɆ..💖 Ohh I thought map function or something like that 😃 👍 Thank you
7th May 2021, 11:55 AM
Pranav Hirani
Pranav Hirani - avatar
+ 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
7th May 2021, 3:37 PM
Pranav Hirani
Pranav Hirani - avatar
+ 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
9th May 2021, 7:38 AM
MOHAMMAD IRSHAD ALI
MOHAMMAD IRSHAD ALI - avatar
+ 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?
7th May 2021, 12:02 PM
Pranav Hirani
Pranav Hirani - avatar
0
-Dictionaries are unordered collection of data values. -It is mutable -It works on key value pairs
7th May 2021, 6:27 PM
Utsav Singh
Utsav Singh - avatar