Guest User

Python StackOverflow

a guest
Jun 24th, 2015
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. import time
  2. print("Count Cycles")
  3. print("Enter key simulates manual cycle, automatic cycle occurs every 5 seconds")
  4. mode = input("(M)anual or (A)utomatic?")
  5. mcycle = ""
  6. x = "Y"
  7. while x == "Y":
  8. if mode == "M":
  9. counter = 0
  10. ncounter = 1
  11. print("Press enter to start manual mode, press any thing else to stop once manual mode has begun. Typer RESET to reset counter. If you would like to switch modes, type MODE SET, then A or M.")
  12. mcycle = input()
  13. while mcycle == "" or mcycle == "RESET":
  14. print("Current cycle:", counter, "Next cycle:", ncounter)
  15. mcycle = input()
  16. counter +=1
  17. ncounter +=1
  18. if mcycle == "RESET":
  19. counter = 0
  20. ncounter = 1
  21. if mcycle == "MODE SET":
  22. mode = input()
  23.  
  24.  
  25.  
  26.  
  27. elif mode == "A":
  28. print("A cycle will take place every 5 seconds.")
  29. cyle = "RUN"
  30. counter = 0
  31. ncounter = 1
  32. while cycle == "RUN" or cycle == "RESET":
  33. print("Current cycle:", counter, "Next cycle:", ncounter)
  34. time.sleep(5)
  35. counter += 1
  36. ncounter += 1
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. else:
  45. mode = input("Unknown mode, please select again")
Advertisement
Add Comment
Please, Sign In to add comment