Advertisement
kingjamez12

license

Dec 13th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #from boxed_msg import *
  2. import datetime
  3. from datetime import date, timedelta
  4.  
  5. """ Initial way to store the licenses and certifications expiration dates.
  6. """
  7.  
  8. licenses = {
  9. "New York State Driver License": date(2021,12,11),
  10. "Security Guard License": date(2020,11,20),
  11. "Z-89 Fire Life Safety Director": date(2020,5,21),
  12. "F-85 Fire Safety Director": date(2020,3,7),
  13. "N-60 Watchperson at Construction Sites": date(2022,2,20),
  14. "S-14 City Wide Standpipe System": date(2022,2,12),
  15. "S-12 City Wide Sprinkler Systems": date(2020,6,4)
  16. }
  17.  
  18. sort_lic = {k: v for k, v in sorted(licenses.items(), key=lambda item:item[1])}
  19.  
  20. msg = ""
  21. today = datetime.date.today()
  22.  
  23. for license_name, exp_date in sort_lic.items():
  24. if (exp_date - today) <= timedelta(days=900):
  25. msg += f"{license_name} exp {exp_date} renew by {exp_date - timedelta(weeks=3)}\n"
  26.  
  27. # box_msg(msg=msg, title= "License and Certificate Expiration Date")
  28.  
  29. def add_lic(msg):
  30. lic_name = str(input("Enter the name of the license you want to add: "))
  31. exp_date = str(input("Enter the expiration date of the license (Y,D,M): "))
  32. exp_obj = datetime.datetime.strptime(exp_date, '%Y %m %d').date
  33.  
  34.  
  35. add_lic(msg)
  36.  
  37. print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement