Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python problem. PRACTICE EXERCISES 3. Write a function chocolate bag that takes 3 integers as input. The first input indicated the number of small (1

Python problem.
image text in transcribed
PRACTICE EXERCISES 3. Write a function chocolate bag that takes 3 integers as input. The first input indicated the number of small (1 kg) chocolate bars you have, the second the number of big (5 kg) chocolate bars you have, and the third the number of kg of chocolate you want in your bag. The function returns the number of small bars to use to fill the bag, assuming we always use big bars before small bars. It returns - 1 if it can't be done. Example: chocolate bag (4, 1, 9) returns 4 chocolate_bag (4, 1, 10) returns - 1 chocolate_bag (4, 2, 7) returns 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions