[Tutor] Having Unusual results
Jag Sherrington
braveart08 at yahoo.com.au
Sat May 2 06:12:40 CEST 2015
Hi Can anyone tell me where I am going wrong the end result doesn't add up?
people = int(input('Enter how many people '))numdogs = int(input('Enter how many dogs '))
hotdogs = 10buns = 8dogsleft = 0bunsleft = 0
# total number of hot dogs neededdogs_needed = (numdogs * people)
# how many packages of hot dogspackdogs = (dogs_needed / hotdogs)
# how many packs of buns neededpackbuns = (dogs_needed / buns)
# how many hot dogs leftdogsleft = (packdogs * 10, - dogs_needed)
# how many buns leftbunsleft = (packbuns * 8, - dogs_needed)
print('Here are the details:')
print('Total hot dogs needed: ', dogs_needed)
print('Packs of hot dogs ', packdogs)
print('Packs of buns ', packbuns)
print('Dogs left: ', dogsleft)
print('Buns left: ', bunsleft)
THIS IS THE RESULT
Enter how many people 10Enter how many dogs 2Here are the details:Total hot dogs needed: 20Packs of hot dogs 2.0Packs of buns 2.5Dogs left: (2.0, -20)Buns left: (2.5, -20)
Many thanks for your help.
BraveArt Multimedia
More information about the Tutor
mailing list