Jan-03-2017, 07:01 AM
Also note, as your function is altering the dictionary in place there is no need for the return statements.
You could just write this:
You could just write this:
dic = {3:0.2, 4:0.5, 5:0.1, 6:0.8, 7:0.34} def function(dic): if dic: dic[100] = 0.1 function(dic) print(dic[100])