Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. records = {}
  2. areas = {}
  3.  
  4. while True:
  5. cmd = input()
  6. if cmd == "Last Info":
  7. break
  8. cmd = cmd.split(":")
  9. command = cmd[0]
  10. name = cmd[1]
  11. value = int(cmd[2])
  12. area = cmd[3]
  13.  
  14. if area not in areas:
  15. areas[area] = []
  16.  
  17. if command == "Add":
  18. if name not in records:
  19. records[name] = value
  20. areas[area] += name
  21. else:
  22. records[name] += value
  23. else:
  24. if name in records:
  25. records[name] -= value
  26. if records[name] <= 0:
  27. print(f"{name} was successfully fed")
  28. del records[name]
  29.  
  30.  
  31. for k, v in list(records.items()):
  32. pass
  33.  
  34.  
  35. print(records)
  36. print(areas)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement