I need to count the amount of upper-case letters in a user entered sentence.

When I search Google for a solution, I came across the command `sum(1 for c in sentence if c.isupper()))`. 

I used it and it works but I also need to explain the code to my teacher. 

How would I go about doing this?