id/email
password
forgot password | create account
Or use
about | help | code help+videos | done | prefs
CodingBat code practice

 

makebricks-introduction > make_chocolate
prev  |  next  |  chance

We want make a package of goal kilos of chocolate. We have small bars (1 kilo each) and big bars (5 kilos each). Return the number of small bars to use, assuming we always use big bars before small bars. Return -1 if it can't be done.

make_chocolate(4, 1, 9) → 4
make_chocolate(4, 1, 10) → -1
make_chocolate(4, 1, 7) → 2

...Save, Compile, Run

def make_chocolate(small, big, goal):


Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 224.0

Copyright Nick Parlante 2016 - privacy