Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
When will the except clause get executed ? Because if we give a float , it will get converted to int in the try clause
When I give a float in the first place , wouldn't it always get converted to an int so that the except clause never gets executed ?? Need a little help here .
Thanks in advance
It won't be converted to an int - if there's a decimal place, the conversion to an int will fail; "blows up", I think the teachers called it, meaning that execution will move to the
Got it !! Thanks Steve :)
Sivasuryateja Raparla3,966 Points
i got the same question. the try catch block was very confusing. Kenneth missed explaining two important things when explaining this video.
- The number input is a string and
- In the shell he didn't walk through how the compiler would interpret the code when it is executed.
I am little disappointed in this video as kenneth left those two points