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)
![Luke Tate](https://secure.gravatar.com/avatar/f75a2384ba0172ad7547a937279cb605?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Luke Tate
Courses Plus Student 2,256 PointsWhy do I keep getting End of File parsing errors, when raising exceptions?
Here is the code from the video I was following:
def split_check(total, number_of_people): if number_of_people <= 1: raise ValueError("More than 1 person is required to split the check")
return math.ceil(total/number_of_people)
try:
total_due = float(input("What is the total? "))
number_of_people = int(input("How many people? "))
amount_due = split_check(total_due, number_of_people)
except ValueError as err:
print("Oh no! That's not a valid value. Try again...")
print("({})".format(err))
else:
In the console when I type python and the file's name, this message keeps occurring: "File "Functions.py", line 55
SyntaxError: unexpedcted EOF while parsing "
2 Answers
![ThatOneCoder -](https://uploads.teamtreehouse.com/production/profile-photos/9314632/micro_download.jpg)
ThatOneCoder -
9,310 PointsWell I don't see the problem in your code so here is mine,
import math
def split_check(total, number_of_people):
if number_of_people <= 1:
raise ValueError("More than 1 person is required to split the check")
return math.ceil(total / number_of_people)
try: total_due = float(input("Whats the cost? ")) number_of_people = int(input("How many people? ")) amount_due = split_check(total_due, number_of_people) except ValueError as err: print("Oh no! That's not a valid value! Try again...") print("({})".format(err)) else: print("Each person owns ${}".format(amount_due))
![Luke Tate](https://secure.gravatar.com/avatar/f75a2384ba0172ad7547a937279cb605?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Luke Tate
Courses Plus Student 2,256 PointsThank you! I believed that last print function just fixed it.
![ThatOneCoder -](https://uploads.teamtreehouse.com/production/profile-photos/9314632/micro_download.jpg)
ThatOneCoder -
9,310 PointsDid you import math??? That may be the problem.
![Luke Tate](https://secure.gravatar.com/avatar/f75a2384ba0172ad7547a937279cb605?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Luke Tate
Courses Plus Student 2,256 PointsI have already did that twice. I'm still get that same error.
boi
14,242 Pointsboi
14,242 PointsYour problems will be solved in this video >>> click here