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 Python Basics Functions and Looping Returning Values

281 Points

i tryed to add input questions for the 2 varibles but it didnt work ..

def split_check(total,num_of_ppl): cost_per_person = total / num_of_ppl return cost_per_person

total = input("what was the total of the check?") num_of_ppl = input("how many ppl are contributing?")

amount_due = split_check(total,num_of_ppl) print ("each person owes $()".format(amount_due))

just curious why this doesnt work... thank you

1 Answer

input returns a string so these values will have to be converted to numbers prior to passing them to the split_check function where division is performed. You see this conversion in the video with the float and int methods.

total = float(input("what was the total of the check?"))


num_of_ppl = int(input("how many ppl are contributing?"))
281 Points

Face Palm I remember now than you