title: How to allow both integers and strings in input?
body: <p>I just started learning Python about a week ago, and for one of my first projects I built a really simple random number guessing game as part of the course I'm in. However, I tried to add an extension to my code that would print something different if the word "no" was entered as an input, even though the input only accepts integers in my code. In a previous question, I learned that try/except could be used to print something if an error occurred, (such as by entering "no" instead of an integer) per the following template:</p>
  
  <p><a href="https://i.stack.imgur.com/gaG8i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gaG8i.png" alt="enter image description here"></a></p>
  
  <p>In turn, my code looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/jvjPh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jvjPh.png" alt="enter image description here"></a></p>
  
  <p>And the output I get when I enter no looks like this:</p>
  
  <p>Enter a number between 1 and 21: no</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/camer/Desktop/Python/randomintproject.py", line 3, in &lt;module&gt;
      guess = int(input("Enter a number between 1 and 21: "))
  ValueError: invalid literal for int() with base 10: 'no'
  </code></pre>
  
  <p>If the template code works, then what am I doing wrong?</p>