This program is written in Python and calculates the sum of values in a dictionary called "marks". The "marks" dictionary has five key-value pairs, each representing a subject and its corresponding marks obtained by a student. The keys are "m1", "m2", "m3", "m4", and "m5", and their respective values are 92, 56, 88, 97, and 89. In the program, an empty list called "total" is created to store the values of the dictionary.
Next, a for loop is used to iterate through the values of the dictionary "marks". For each iteration, the value is added to the list "total" using the "append()" method. Finally, the sum of the values in the list "total" is calculated using the "sum()" function, and the result is stored in the variable "total". The program prints the sum of values using the "print()" function.
marks={"m1":92 , "m2":56 , "m3":88 , "m4":97 , "m5":89} total = [] for i in marks.values(): total.append(i) print("Sum of Values :",sum(total))
Sum of Values : 422
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions