Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 19 Online
OpenStudy (anonymous):

Function name: (Parameter types) -> Return type bun_packages_required: (int) -> int Description: There are ten hot dogs in a package of hot dogs and eight buns in a package of buns. Return the number of packages of hot dog buns needed for the given number of packages of hot dogs (assuming one hot dog per bun). Note: you should import math in order to use a function from that module. i have to do this using python, does anyone have an idea of what coding i could possibly create? i'm a beginner

OpenStudy (anonymous):

Have you managed to solve this problem on paper first? I believe the difficulty of this problem lies in the math aspect and not the programming aspect of it.

OpenStudy (anonymous):

Tip: Least Common Multiple

OpenStudy (anonymous):

ye no i understand what i have to find im just confused on what i should use to reiterate it on the program because he wants us to use the math function from the import and what not

OpenStudy (anonymous):

I see... Please post your implementation and we can then review it and help you with it!

OpenStudy (anonymous):

Maybe you could use the gcd function of the fractions library!

OpenStudy (anonymous):

Sorry to be a pain... but if I just give you the answer, then you won't learn anything. If you don't want to think at all, send me a message and I will give you the answer there!

OpenStudy (anonymous):

My original thought on this would be something like. If the modulus of hot dogs and buns is greater than 0 then the answer is 1 more than the absolute of hot dogs divided by buns. This pseudocode is then relatively easy to change into actual code. Now, looking at the math function I also found math.modf that can be used similarly.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!