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 trialMark Chang
5,214 PointsMy code doesn't work
The output result is different from the video's i check my code again and again but I still couldn't find the problem.
My code (click "check_please.py" to open the code that i am asking): https://w.trhou.se/rxur115imd
result:
What is the total? 20
How many people? 0
Oh no! That's not a valid value. Try again...
Traceback (most recent call last):
File "check_please.py", line 12, in <module>
amount_due = split_check(total_due, number_of_people)
File "check_please.py", line 6, in split_check
raise ValueError("More than 1 person is required to split the check")
ValueError: More than 1 person is required to split the check
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "check_please.py", line 16, in <module>
print("({})".format(err))
NameError: name 'err' is not defined
1 Answer
Pedro Cabral
33,586 PointsHi Mark, this is the clue: NameError: name 'err' is not defined, you forgot to add as err after the exception's name.
Mark Chang
5,214 PointsMark Chang
5,214 PointsThank you :)