Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. def codeChecker(wetland_type, modifiers):
  2. modifiers = modifiers.split(', ')
  3. incorrect_modifiers = []
  4. match_dict = {'LOBA': ['ay', 'bv', 'fm', 'fn', 'gf', 'hs', 'il', 'mr', 'ox', 'sa', 'ag'],
  5. 'LOFP': [],
  6. 'LOFR': [],
  7. 'LEBA': [],
  8. 'LEFP': [],
  9. 'LEFR': [],
  10. 'TEBA': [],
  11. 'TEFL': [],
  12. 'TEFR': [],
  13. 'TESL': []}
  14. for modifier in modifiers:
  15. if modifier not in match_dict[wetland_type]:
  16. incorrect_modifiers.append(modifier)
  17. return(', '.join(incorrect_modifiers))
  18.  
  19. codeChecker('LOBA', "ay, bv, hs") # input containing all valid modifiers
  20. # will leave the field empty as there are no errors
  21. codeChecker('LOBA', 'ay, bg, bv') # input containing one incorrect modifier
  22. # will return 'bg'
  23. codeChecker('LOBA', 'ay, bg, id') # input containing multiple incorrect modifiers
  24. # will return 'bg, id'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement