title: Counting and Error Handling Block Guessing Game
body: <p>Could you, please, help me to understand how should I use try/except block and count tries at the same time.
  Here is the code without try/except block (it seems it's working fine):</p>
  <pre><code>import random
  
  number = random.randint(1, 10)
  tries = 3
  name = input('Hi! What is your name?\n')
  
  answer = input(f'{name}, let\'s play a game! Yes or No?\n')
  
  if answer == 'Yes':
      print(f'But be aware: you have only {tries} tries!\nReady?')
      chat = input('')
      print('Ok, guess a number from 1 to 10!')
      
      while tries != 0:
          choice = int(input('Your choice: '))
          tries -= 1
          if choice &gt; number:
              print('My number is less!')
          elif choice &lt; number:
              print('My number is higher!')
          else:
              print('Wow! You won!')
              break
          print(f'You have {tries} tries left.')
      if tries == 0 and choice != number:
          print(f'Sorry, {name}, you lost... It was {number}. Try next time. Good luck!')
  else:
      print('No problem! Let\'s make it another time...')
  </code></pre>
  <p>This one is with try/except block.. Not sure where should I place 'choice' variable and where count 'tries', it keeps looping and looping:</p>
  <pre><code>import random
  
  number = random.randint(1, 10)
  tries = 3
  name = input('Hi! What is your name?\n')
  
  answer = input(f'{name}, let\'s play a game! Yes or No?\n')
  
  if answer == 'Yes':
      print(f'But be aware: you have only {tries} tries!\nReady?')
      chat = input('')
      print('Ok, guess a number from 1 to 10!')
      
      while True:
          try:
              choice = int(input('Your choice: '))
              if 0 &lt; choice &lt; 11:
                  while tries != 0:
                      tries -= 1
                      if choice &gt; number:
                          print(f'My number is less!')
                      elif choice &lt; number:
                          print(f'My number is higher!')
                      else:
                          print('Wow! You won!')
                          break
                      print(f'You have {tries} tries left.')
                  if tries == 0 and choice != number:
                      print(f'Sorry, {name}, you lost... It was {number}. Try next time. Good luck!')
              else:
                  print(f'Hey {name}, I said, print a number from 1 to 10!')
  
          except ValueError:
              print('Please, enter a number!')
  
  else:
      print('No problem! Let\'s make it another time...')
  </code></pre>
  <p>Thanks!</p>