Advertisement
Larrisa

Untitled

May 2nd, 2020
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. def openOrSenior(data):
  2.     # Hmmm.. Where to start?
  3.     #senior age >=55, handicap >7 (-2 >= range <=+26)
  4.     output_list = []
  5.     print(data)
  6.     for element in data:
  7.         print('age - {}, handi - {}'.format(element[0], element[1]))
  8.        
  9.         if element[0] >=55 and element[1] > 7:
  10.             output_list.append("Senior")
  11.            
  12.         else:
  13.             output_list.append("Open")
  14.            
  15.         print(output_list)
  16.         return output_list
  17.  
  18. ##Run
  19. openOrSenior([[45, 12],[55,21],[19, -2],[104, 20]]
  20. ##expected
  21. ['Open', 'Senior', 'Open', 'Senior']
  22.  
  23. ##Output
  24. ['Open']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement