1
In function bonAppetit
, i want to pick up only the content k
(in the case k=1 and the value is 10), and see if that number is less than or equal to b
.
Only my program is running the whole list.
def bonAppetit(bill, k, b):
n = len(bill)
for k in range(n):
if bill[k] >= b:
print('Bon Appetit')
del(bill[k])
x = sum(bill)
if x / 2 < b:
y = (b - (x / 2))
print(f'{y:.0f}')
print(bonAppetit([3, 10, 2, 9], 1, 7))
desired output:
Bon Appetit
output that I’m having:
Bon Appetit
Bon Appetit