furas

Python - example [FB:learnpython.org]

Oct 3rd, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. while True:
  2.    
  3.     usr_command = input("Type 'play' to start, type 'stop' to quit: ")
  4.     usr_command = usr_command.strip().lower() # remove some spaces and convert to lower
  5.    
  6.     if usr_command == "stop":
  7.         break    # leave `while` loop
  8.     if usr_command != "play":
  9.         continue # return to the beginning of `while` loop and ask again
  10.  
  11.     print("now we can play")
Add Comment
Please, Sign In to add comment