Computer Science Of Engineering

Simple and practical computer science tutorials, programming guides, and engineering concepts for students and beginners.

Breaking

Friday, April 25, 2025

Write a python program to sum all the items in a given dictionary.

 # Sample dictionary with numeric values

my_dict = {

    "a": 10,

    "b": 20,

    "c": 30

}


# Sum of all values

total = sum(my_dict.values())


# Print the result

print("Sum of all items in the dictionary:", total)

Output:


No comments:

Post a Comment