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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Alberto Serafini](https://secure.gravatar.com/avatar/9d0ae74fb7bd64f5d86b825852b44191?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Alberto Serafini
1,211 PointsHi everybody! I wrote the code exactly like it was in the video until 4.46 and is not working for me. Please Help!
It's giving me: NameError: split_check not defined
2 Answers
![Jeff Muday](https://uploads.teamtreehouse.com/production/profile-photos/5900142/micro_jeff_face.jpg)
Jeff Muday
Treehouse Moderator 28,718 PointsWhen I see an error like that it means you might have forgotten to define split_check()
before you tried to use it
This can happen if you try to call to split_check()
before it was defined or imported. Here I type in to the Python REPL (command interpreter) launched from the command line and you can see the error.
PS C:\Users\jeff> python
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # If I try to use split_check before it is defined... see error below.
>>> print(split_check(35.22, 2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'split_check' is not defined
>>> # now, I type the function in to define it...
>>> def split_check(total, number_of_people):
... cost_per_person = total / number_of_people
... return cost_per_person
...
>>> # now, it will work.
>>> print(split_check(35.22, 2))
17.61
>>>
![Alberto Serafini](https://secure.gravatar.com/avatar/9d0ae74fb7bd64f5d86b825852b44191?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Alberto Serafini
1,211 PointsThank you very much Jeff that was really helpful!