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..
3 Answers
+ 3
Ratnapal Shende
Nothing will happen. You just can't add new data in dictionary.
+ 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)
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?