Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import random
  2.  
  3. positionList = []
  4. okayToContinue = 0
  5. gap = 3
  6.  
  7. for _ in range(10):
  8.  
  9. okayToContinue = 0
  10.  
  11. pos = random.randint(1,40)
  12. while okayToContinue != 1:
  13. for item in positionList:
  14. for i in range (1, gap):
  15. if (pos + i) == item:
  16. print "+"
  17. pos = random.randint(1,40)
  18. okayToContinue = 0
  19. elif (pos - i) == item:
  20. print "-"
  21. pos = random.randint(1,40)
  22. okayToContinue = 0
  23. elif pos == item:
  24. print "="
  25. pos = random.randint(1,40)
  26. okayToContinue = 0
  27. else:
  28. okayToContinue = 1
  29.  
  30. if len(positionList) < 1:
  31. okayToContinue = 1
  32.  
  33. positionList.append(pos)
  34.  
  35. print positionList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement