title: Python: Random 4 digit password guessing, can't figure out 1 problem
body: <p>I'm new to Python. I have a program that lets you guess a random 4-digit password. For example, if the password is <code>5530</code>, if I guess one <code>5</code> inside (such as <code>5111</code>), it says I guessed 2 numbers correctly. If the password is <code>5535</code>, it says I guessed 3 numbers correctly.</p>
  <p>But in reality, it interpreted the single <code>5</code> in my answer to be correct for the other <code>5</code>s. I want it to only say I guessed one number correctly if there and two or three <code>5</code>s, two correct if I typed two <code>5</code>s for <code>5530</code>, three correct if I type three <code>5</code>s for <code>5535</code>.</p>
  <pre><code>import random
  
  no1 = random.randint(0, 9)
  no2 = random.randint(0, 9)
  no3 = random.randint(0, 9)
  no4 = random.randint(0, 9)
  
  password = str(no1) + str(no2) + str(no3) + str(no4)
  count = 0
  
  if no1 % 2 == 0:
      count += 1
  
  if no2 % 2 == 0:
      count += 1
  
  if no3 % 2 == 0:
      count += 1
  
  if no4 % 2 == 0:
      count += 1
  
  print(password)
  print(f&quot;Hint: The password consists of {count} even number(s)&quot;)
  
  guess = input(&quot;Guess the 4 numbers: &quot;)
  present = 0
  
  if str(no1) in guess:
      present += 1
  
  if str(no2) in guess:
      present += 1
  
  if str(no3) in guess:
      present += 1
  
  if str(no4) in guess:
      present += 1
  
  if present == 4:
  
      if guess == password:
          print(&quot;Congrats! You have guessed the password correctly.&quot;)
  
      else:
          print(&quot;All the numbers are present but not in the correct sequence.&quot;)
          print(f&quot;You did not make it! The password is {password}.&quot;)
  
  else:
      print(f&quot;{present} number(s) of your guess are present in the password.&quot;)
      print(f&quot;You did not make it! The password is {password}.&quot;)
  </code></pre>
  <p><strong>P.S.</strong> I expect my code below may be shortened with <code>range</code> and stuff, but I'm not confident in doing that, so can someone help me out with that?</p>