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 triallinzhang5
2,398 PointsValueError syntax error message in my own terminal
So, when I tried to execute this ValueError syntax in my own python, and input "five" as argument, I get this error message:
Traceback (most recent call last): File "exceptions.py", line 2, in <module> count = int(input("Give me a number: ")) File "<string>", line 1, in <module> NameError: name 'five' is not defined
Anyone can explain this to me? Thank you so much.
The full syntax inputted as the video shown: try: count = int(input("Give me a number: ")) except ValueError: print("That's not a number!") else: print("Hi" * count)
4 Answers
Nicolas Bassano
2,125 PointsHi!
Wich version of Python do you have?
Con you post the markdowned version of the code??
I tried mine and its working.
Eric Ouellette
3,332 PointsHi,
Did you solve your problem? I have the same so if you solved it can you tell me what you did ?
Thanks
Robert Li
938 Pointsi used NameError instead of ValueError and it worked, I was using a mac terminal
Murat Kuru
1,909 PointsNameError solved my "problem" too.
Sky Lu
1,260 PointsSky Lu
1,260 PointsI just used workspace, the version is 3.5.0, it seems ValueError can't be instead of other words.