title: How to use sys.exit() in Python
body: <pre><code>player_input = '' # This has to be initialized for the loop
  
  while player_input != 0:
  
      player_input = str(input('Roll or quit (r or q)'))
  
      if player_input == q: # This will break the loop if the player decides to quit
  
          print("Now let's see if I can beat your score of", player)
          break
  
      if player_input != r:
  
          print('invalid choice, try again')
  
      if player_input ==r:
  
          roll= randint (1,8)
  
          player +=roll #(+= sign helps to keep track of score)
  
          print('You rolled is ' + str(roll))
  
          if roll ==1:
  
              print('You Lose :)')
  
              sys.exit
  
              break
  </code></pre>
  
  <hr>
  
  <p>I am trying to tell the program to exit if <code>roll == 1</code> but nothing is happening and it just gives me an error message when I try to use <code>sys.exit()</code></p>
  
  <hr>
  
  <p>This is the message that it shows when I run the program:</p>
  
  <pre><code>Traceback (most recent call last):
   line 33, in &lt;module&gt;
      sys.exit()
  SystemExit
  </code></pre>