+ 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

13th Apr 2021, 8:43 AM
Rosy
Rosy - avatar
9 Respostas
+ 5
Myk Dowling and Tapabrata Banerjee Thank you for the code! :)
15th Apr 2021, 8:48 AM
Rosy
Rosy - avatar
+ 4
In particular, use the floor divide and min() builtin
13th Apr 2021, 9:29 AM
Myk Dowling
Myk Dowling - avatar
+ 4
15th Apr 2021, 6:20 AM
Myk Dowling
Myk Dowling - avatar
+ 3
a = list(map(int,input().split(", "))) print(min(a[0], a[1]//3, a[2]//6)) # Hope this helps
14th Apr 2021, 11:49 AM
Calvin Thomas
Calvin Thomas - avatar
+ 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.
14th Apr 2021, 9:23 PM
Myk Dowling
Myk Dowling - avatar
+ 2
Myk Dowling I usually aim to make my codes small, often forgetting about their complexity. I'll take care about that next time.
15th Apr 2021, 5:43 AM
Calvin Thomas
Calvin Thomas - avatar
0
Input the number of the ingredient
13th Apr 2021, 1:13 PM
Hajarat Olamide
Hajarat Olamide - avatar