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


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


9 Answers

New Answer


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.


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


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


Here's my pythonic take:


Rosy Welcome😊


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


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.


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


Input the number of the ingredient