title: Python Problems with Guessing Numbers
body: <p>&quot;&quot;&quot;</p>
  <p>I am new to coding in general and I have looked up how to fix this but when I input a letting than
  a letting 2x then a number this happens</p>
  <pre><code>ges a number 1 tho 100 t
  your ges is t
  plz input a positive number below 100 that is not a word. exmp(42)
  ges a number 1 tho 100 w
  your ges is w
  plz input a positive number below 100 that is not a word. exmp(42)
  </code></pre>
  <p>this is where I get confused</p>
  <pre><code> ges a number 1 tho 100 2
   your ges is 2
   2
   your ges is t
   plz input a positive number below 100 that is not a word. exmp(42)
   ges a number 1 tho 100 2
   your ges is 2
   2
   None
     Traceback (most recent call last):
       File &quot;c:\Users\BertD\OneDrive\Desktop\random_number_gessing_game.py&quot;, line 20, in&lt;module&gt;
           ges = int(ges)
      ValueError: invalid literal for int() with base 10: 't'
  </code></pre>
  <p>I am concerned about how python is coming up with this?
  It's a tuff puzzle to solve for me.</p>
  <p>&quot;&quot;&quot;</p>
  <pre><code>import random
  
  ges = input(&quot;ges a number 1 tho 100 &quot;)
  
  def valid_ges(num):
  
  while True:
      print(&quot;your ges is &quot;+str(num))
      if num.isdigit():
          print(num)
          break
      elif num != num.isdigit():
          print(&quot;plz input a positive number below 100 that is not a word. exmp(42)&quot;)
          num = input(&quot;ges a number 1 tho 100 &quot;)
  
      elif num &gt; 100:
          print(&quot;try a number below 100&quot;)
          num = input(&quot;pic a number 1 tho 100 &quot;)
  
  valid_ges(ges)
  
  print(valid_ges(ges))
  
  r = random.randint(1, 100)
  
  ges = int(ges)
  
  while ges != r:
  
      if (ges &lt;= 100):
          print(&quot;your &quot;+str(r - ges)+&quot; away&quot;)
          ges = abs(int(input(&quot;pic a number 1 tho 100 &quot;)))
      elif(ges == r):
          break
  
  print(&quot;yay you did it&quot;)
  </code></pre>
  <p>thank you for your time and have a nice day!</p>