title: How to check that the Enter key was pressed in Python?
body: <p>In the program written below, if I hit enter, I get:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/Claude/Desktop/practice.py", line 11, in &lt;module&gt;
      guess = int(input("Your guess: "))
  ValueError: invalid literal for int() with base 10: ''*
  </code></pre>
  
  <p>I could not find an answer while searching ways to to detect if the "Enter" key was pressed. Could someone help?</p>
  
  <pre><code>from random import randint
  
  # Generates a number from 1 through 10 inclusive
  random_number = randint(1, 10)
  
  guesses_left = 6
  
  while (guesses_left &gt; 0):
  
          guess = int(input("Your guess: "))
          if (guess == random_number):
              print ("You win!")
              ans = input("Do you want to play again?:")
          if (ans == 'y' or ans == 'Y'):
              guesses_left = 5
              guess = int(input("Your guess: "))
          else:
              break
      #elif (guess == ""):
      #   print ("Please enter a number between 1 and 10")
      elif(guess != random_number):        
          guesses_left -= 1
  else:
      print ("You lose!")
  </code></pre>