Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics Functions and Looping Exception Flow

livia salgado
livia salgado
4,407 Points

i understand why A and B will be the output and why C and D will not but why E and F are aldo in the output?

the answer to the quiz is in question 1 is ABEF but I don't really understand why: there is no value error or type error so that is clear why those 2 are out, but else print E and F?: can be other ways to answer that are also correct? thank you

1 Answer

Trevor J
seal-mask
.a{fill-rule:evenodd;}techdegree
Trevor J
Python Web Development Techdegree Student 2,107 Points

When the code is executed it starts at the top and works down each line.
Because except ValueError: and except TypeError: are not executed the else: line prints E
F is printed too as it is after the try: statement has completed.

If there was a ValueError, C would be printed or TypeError, D would be printed instead of E
you can see a code example here https://repl.it/repls/PortlyIrresponsibleNotifications