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

No clue how to follow the logic in this code

Can anyone break this down for me please?

Mark Sebeck
Mark Sebeck
Treehouse Moderator 38,105 Points

Make sure when you ask a question about quizzes you copy and paste the question. Quizzes are in random order so we won't always know what question is giving you issues.

1 Answer

Harald N
Harald N
15,843 Points

I haven't programmed in python much, but it seems like the (result = 'test' + 5) causes an typeError, witch make the program skip print(b) and since it's not an valueError it skips print(c) as well. The try block catches the error internally and the else statement doesn't run. At the end, the print(f) runs, and the program finishes.

Not 100% sure, but think this is the main essence. Hope it helps.