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
Eva Feng
3,404 PointsValueError vs TypeError
I find it a bit confusing to distinguish between ValueError and TypeError. For example, when you have float( a string ) - it shows up as ValueError. But shouldn't it be TypeError? The type inside the brackets should be a number instead of a string?
1 Answer
Steven Parker
243,886 PointsIn this case, it's not the type causing the issue but the value.
For example: float("boat") will return a ValueError, but float("42") returns 42.0 (and no error).