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

Python

Output isn't correct?

Here the code is supposed to calculate the number of people a bill is supposed to be split amongst, it asks the two questions right, but doesn't give the answer, It just says Each person owes $(). And doesn't give the amount??? Here is the Code:

import math

def split_check(total,number_of_people): cost_per_person = math.ceil(total / number_of_people) return cost_per_person

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)

print("Each person owes $()".format(amount_due))

1 Answer

Steven Parker
Steven Parker
243,658 Points

The typical placeholder token in a format string is a pair of braces ("{}"). I'm not familiar with a dollar-sign and parentheses syntax.

Thank You so much, I really appreciate it..