0

what will happen if I assign key: value pair outside the {} dict ?

my_dict={'a':100,'b':200} my_dict['c']:300 print(my_dict) accidently instead of "=" we type ":" what will happen ? please explain..

10th Jan 2021, 5:35 AM
Ratnapal Shende
Ratnapal Shende - avatar
3 Réponses
+ 3
Ratnapal Shende Nothing will happen. You just can't add new data in dictionary.
10th Jan 2021, 6:27 AM
A͢J
A͢J - avatar
+ 3
Ratnapal Shende I don't know why it's not giving error but if you print that line then error will come print(my_dict['c']:300)
10th Jan 2021, 10:33 AM
A͢J
A͢J - avatar
0
I Am AJ ! every command have some it's own functionality.. then what actually that line is doing.. if nothing then it should be result in error right?
10th Jan 2021, 10:23 AM
Ratnapal Shende
Ratnapal Shende - avatar