Advertisement
pacho_the_python

Stock

Mar 14th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. food_data = input().split(" ")
  2. products = input().split(" ")
  3.  
  4. food_stat = {}
  5.  
  6. for i in range(0, len(food_data), 2):
  7.     food = food_data[i]
  8.     quantity = int(food_data[i + 1])
  9.  
  10.     food_stat[food] = quantity
  11.  
  12. for y in products:
  13.     if y in food_stat:
  14.         print(f"We have {food_stat[y]} of {y} left")
  15.     else:
  16.         print(f"Sorry, we don't have {y}")
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement