Advertisement
aneliabogeva

Filter Base

Jul 4th, 2019
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. def separation():
  2. print("====================")
  3.  
  4. command = input()
  5. database_salary = {}
  6. database_age = {}
  7. database_posistion = {}
  8.  
  9. while not command == 'filter base':
  10. data = command.split(" -> ")
  11. key = data[0]
  12. value = data[1]
  13. if value.isdigit():
  14. database_age[key] = value
  15. elif value.replace('.', '', 1).isdigit():
  16. value = float(value)
  17. if value % 100 == 0:
  18. if value % 10 == 0:
  19. database_age[key] = value
  20. else:
  21. database_salary[key] = value
  22. else:
  23. database_posistion[key] = value
  24. command = input()
  25.  
  26. filter_base = input()
  27. if filter_base == 'Position':
  28. for key, value in database_posistion.items():
  29. print(f"Name: {key}")
  30. print(f"Position: {value}")
  31. separation()
  32. elif filter_base == "Age":
  33. for key, value in database_age.items():
  34. print(f"Name: {key}")
  35. print(f"Age: {value}")
  36. separation()
  37. elif filter_base == "Salary":
  38. for key, value in database_salary.items():
  39. print(f"Name: {key}")
  40. print(f"Salary: {value}")
  41. separation()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement