hi all, ive been struggling with this problem for a while now, any help is appreciated. the goal of this problem is to input a list of tuples and output a formatted string, see below:
item1 = 'Krusty Burger'
item2 = 'Milkshake'
item3 = 'Krusty Meal Set[Burger + Drink + Krusty Laugh]'
item1_cost = 5.10
item2_cost = 3.50
item3_cost = 10.50
menu_list = [(item1, item1_cost), (item2, item2_cost), (item3, item3_cost)]
expected output:
Krusty Burger $ 5.10
Milkshake $ 3.50
Krusty Meal Set[Burger + Drink + Krusty Laugh] $10.50
how will i go about achieving this? i have tried this method but ljust wont work with float values (i must keep the item costs as floats)
def get_menu():
i = 0
j = 0
while i < len(menu_list):
while j < len(menu_list[i]):
print(menu_list[i][j].ljust(49), end='')
j += 1
print()
j = 0
i += 1
print()