) a Dict={"Bhavna":1, "Richard: : 2, "Firoza" : 10, "Arshnoor" : 20 }
temp=0
for value in a Dict.values():
temp=temp+value
print(temp)
Answers
Answered by
3
Given :
Dict = {"Bhavna" : 1 , "Richard" : 2 , "Firoza" : 10, "Arshnoor" : 20 }
temp = 0
for value in Dict.values():
temp = temp + value
print(temp)
Output :
33
Explanation :
temp = 0
Iteration 1
temp = temp + value
temp = 0 + 1
temp = 1
Iteration 2
temp = temp + value
temp = 1 + 2
temp = 3
Iteration 3
temp = temp + value
temp = 3 + 10
temp = 13
Iteration 4
temp = temp + value
temp = 13 + 20
temp = 33
So, the final value of temp is 33
Similar questions