Advertisement
teeks99

Finding thresholds

Nov 14th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. class state:
  2.    pass
  3.  
  4. # Enter the data
  5. state_values_1991 = []
  6.  
  7. s = state()
  8. s.name = "Missouri"  
  9. s.cost = 1500
  10. state_values_1991.append(s)
  11.  
  12. s = state()
  13. s.name = "Arkansas"  
  14. s.cost = 1200
  15. state_values_1991.append(s)
  16.  
  17. s = state()
  18. s.name = "Illinois"  
  19. s.cost = 1700
  20. state_values_1991.append(s)
  21.  
  22. # Set the threshold
  23. cost_threshold = 1350
  24.  
  25. # Find states above threshold
  26. for state in state_values_1991:
  27.   state.above_threshold = 0 # make this the default
  28.   if state.cost > cost_threshold:
  29.      state.above_threshold = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement