CS101 for loop, same as the sum

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
Hi All I have a question, about the cs101 code that I have writen below.

num_exercises = {“functions”: 10, “syntax”: 13, “control flow”: 15, “loops”: 22, “lists”: 19, “classes”: 18, “dictionaries”: 18, “oop”: 100}

total_exercises = 0

for exercises in num_exercises.values():

total_exercises += exercises

print(total_exercises)

#Gets all values in the dictionary. And stores it into the a variable.

a = num_exercises.values()

#Then prints the sum of the “a” variable

print(sum(a))

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
https://www.codecademy.com/courses/cs-101-livestream-series/lessons/using-dictionaries/exercises/get-all-values

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Ok! what is the question? :slight_smile: