This is the problem I am working through:
The program asks the user for the number of pieces of cake and the number of party-goers, in that order. Print the number of pieces of cake each party-goer receives and the number of pieces of cake left over
My code:
pieces_cake = int(input('Number of pieces of cake:'))
party_goers = int(input('Number of party-goers: '))
def cake_per_person(pieces_cake, party_goers):
cake_per_person = pieces_cake//party_goers
return cake_per_person
def leftover_cake(pieces_cake, party_goers):
leftover_cake = pieces_cake % party_goers
return leftover_cake
print(f"Each party-goer recieves {cake_per_person} pieces of cake\n Pieces of cake that won't be distributed: {leftover_cake}")
Output:
Number of pieces of cake:12
Number of party-goers: 5
Each party-goer recieves <function cake_per_person at 0x000001947A3C51F0> pieces of cake
Pieces of cake that won't be distributed: <function leftover_cake at 0x000001947A5B7EE0>
What am I doing wrong?