# Why is output showing red "actual" and green "expected" but no problem running code?

My Code:

``````gender_freq={}
for row in moma:
gender=row[5]
if gender not in gender_freq:
gender_freq[gender]=1
else:
gender_freq[gender]+=1

template="There are {n} artworks by {g} artists"
for gender,num in gender_freq.items():
output=template.format(n=num, g=gender)
print(output)
``````

What I expected to happen: when I submitted my answer, it would show in Output session as following:

• actual(marked in red) + expected (marked in green)

• There are 2443 artworks by Female artists (marked in red)

• There are 13491 artworks by Male artists (marked in red)

• There are 2,443 artworks by Female artists (marked in green)
• There are 13,491 artworks by Male artists (marked in green)
There are 791 artworks by Gender Unknown/Other artists (marked in purple)

when I changed template code from (template=“There are {n} artworks by {g} artists”) to (template=“There are {n:,} artworks by {g} artists”). Just adding “:,” after “n”, this problem disappeared.

Could anyone please explain me what the output means and marked in different colors? Isn’t the “,” just for easy-to-read format, or is necessary? why? Thank you very much for answering my question!

As per the objectives of this lesson, as explained in the Learn section

The final exercise for this mission will combine two techniques in order to analyze and display information about the frequencies of artwork by artists of different genders. The two techniques we’ll combine are:

1. Creating a frequency table of the genders in the data set, which we have done for both artist ages and artists themselves.
2. Using the `str.format()` and the str formatting specification to display the data in an easy to read format, which we’ve done on both of the previous two screens.

So, formatting the output is a necessity here.

Hope its clear now.
Thanks.