+1 vote
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

Related questions

0 votes
asked Dec 14, 2019 in Python by sharadyadav1986
+1 vote
asked Jan 10, 2021 in Python by rajeshsharma
...