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 trialCarson Bartlett
3,574 PointsWhy does split_check take two inputs when you define it (total, num_of_people), but the code itself asks for inputs?
In other languages you might run a function by saying '''split_check(20,3)''' but in this case the function doesn't require any input variables because the code inside the function prompts the user. I'm also confused as to why it returns these values '''return math.ceil(total / number_of_people)''' before the try block is even called... because inside the try block new variables '''total_due, number_of_people, and amount_due''' are assigned
1 Answer
Steven Parker
229,786 PointsThe part of the program that asks for input is not inside the "split_check" function. That function is only called after the inputs have been converted to numbers, and those numbers are passed to it as the arguments.
Steven Parker
229,786 PointsSteven Parker
229,786 PointsI assume your question is about the Returning Values video.
In future questions, always include a link to the course page (and a time index if a video).