Advertisement
MHMAsuk

AI

Oct 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. def signal(locationA, locationB, trafficA, trafficB):
  2.     if locationA == 'A' and trafficA  == 'H' and locationB == 'B' and trafficB == 'L':
  3.         action = locationA + 'Green' + locationB + 'Red'
  4.     elif locationA == 'A' and trafficA == 'L' and locationB == 'B' and trafficB == 'L':
  5.         action = locationA + 'green' + locationB + 'Red'
  6.     elif locationA == 'A' and trafficA == 'L' and locationB == 'B' and trafficB == 'H':
  7.         action = locationA + 'Red' + locationB + 'Green'
  8.     return action
  9.  
  10. '''
  11. locationA = input('Enter location for A')
  12. locationB = input('Enter location for B')
  13. trafficA = input('Traffic condition in A')
  14. trafficB = input('Traffic condition in B')
  15. '''        
  16.  
  17. locationA = 'A'
  18. locationB = 'B'
  19. trafficA = 'H'
  20. trafficB = 'L'
  21.  
  22. signal(locationA, locationB, trafficA, trafficB)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement