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 trialHaben Gebremeskel
589 PointsWhy is there a "(could not convert string to float: 'l')" message
I don't understand why when you input a string into the "What is the total? " question you also get this message (could not convert string to float: '#whatever your input was'). Shouldn't it be just the "Oh no! That's not a valid value. Try again..." message??
1 Answer
Cameron S
20,537 PointsThe ValueError: could not convert string to float: 'I'
is being raised by Python to indicate what the error is to the developer. "Oh no! That's not a valid value. Try again..." is for the user.
In the video Craig says at the 3:10 mark or so:
"you can get a reference to the exception that was raised And you can do this with a new keyword that's called as, so you say except ValueError as error, we'll just call it err."