0

dictionary

def, I don't get this part

26th Oct 2025, 1:39 PM
Tun Tun
Tun Tun - avatar
5 Risposte
+ 4
dictionaries are in key and values pairs and it do not have any indexes. It can be integer, strings, float anything { 'key':value, 'key':value } Ex: { 'ball':46, 'cricket':34, }
26th Oct 2025, 2:13 PM
Unknowns
+ 3
Unknowns , your statement that any data type can be used in dictionaries can mislead readers. a *key* must be hashable, that means: > a keys must be an *immutable data type*. we cannot use data types as a key that can change after they are created like: > list, dictionary, set *values* can be of any data type
26th Oct 2025, 5:02 PM
Lothar
Lothar - avatar
+ 1
In What language? Python, C#, ...
26th Oct 2025, 1:41 PM
Roman Koerdt
Roman Koerdt - avatar
+ 1
Lothar I never mentioned keys to be of any data type and thanks for clarifying in detail
26th Oct 2025, 5:14 PM
Unknowns
0
def is a pre defined keyword in Python used for creating a function that can be used whenever required. Ex:- def add(): a=4 b=5 print(a+b) add()
27th Oct 2025, 6:35 AM
Kartik
Kartik - avatar