in Python by
If you have a dictionary like this -> d1={“k1?:10,”k2?:20,”k3”:30}. How would you increment values of all the keys ?

2 Answers

0 votes
by

If you have a dictionary like this -> d1={“k1?:10,”k2?:20,”k3”:30}. Use below to increment values of all the keys 

d1={"k1":10,"k2":20,"k3":30}

 

for i in d1.keys():

  d1[i]=d1[i]+1

0 votes
by

If you have a dictionary like this -> d1={“k1?:10,”k2?:20,”k3”:30}. Use below to increment values of all the keys 

d1={"k1":10,"k2":20,"k3":30}

for i in d1.keys():

  d1[i]=d1[i]+1

...