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
0 votes
asked Feb 11, 2021 in Python by SakshiSharma
+2 votes
asked Jul 28, 2019 in R Language by Aarav2017
...