Write a python program to create a dictionary namely numbers with 5 keys(5,10,15,20,25) each having values as 100, update 2nd and 4th values by decreasing 50 to each of them.
Answers
Answered by
0
Answer:
dic={5:100,10:100,15:100,20:100,25:100}
dic[10]=50
dic[20]=50
Explanation:
Answered by
3
my_dict = {k: 100 for k in [5, 10, 15, 20, 25]}
print("before:", my_dict)
for i in range(1, 4, 2):
my_dict[list(my_dict.keys())[i]] = list(my_dict.values())[i] - 50
print("after:", my_dict)
Similar questions