How many burgers?? | Sololearn: Learn to code for FREE!

+5

How many burgers??

In order to make burger a chef needs at least the following ingredients: • 1 piece of chicken meat • 3 lettuce leaves • 6 tomato slices Write down a formula to figure out how many burgers can be made. Get values of chicken meat, lettuce leaves and tomato slices from user. Hint: use Python’s built-in function

4/13/2021 8:43:39 AM

Rosy

9 Answers

New Answer

+7

Input the number of pieces of each ingredient. Divide each entered ingredient by required number of that ingredient. The lowest value will be the number of burgers that can be made. https://code.sololearn.com/cBZvI9DgK5yW/?ref=app

+5

Myk Dowling and Tapabrata Banerjee Thank you for the code! :)

+4

In particular, use the floor divide and min() builtin

+4

Here's my pythonic take: https://code.sololearn.com/c3a11A9337A4

+4

+3

a = list(map(int,input().split(", "))) print(min(a[0], a[1]//3, a[2]//6)) # Hope this helps

+2

Calvin Thomas , that might work, but it's not very pythonic. See if you can write in such a way that someone reading it knows exactly what it's doing, even if they don't understand the way that the built-ins work.

+2

Myk Dowling I usually aim to make my codes small, often forgetting about their complexity. I'll take care about that next time.

0

Input the number of the ingredient