Shady Baddarni 0 Newbie Poster

how can i compare 2 string for bull hit game in python.
i wrote the program itself.
how can i find how many hits and bulls i have.

import string
import random
import re

m = input (' Please input the long of the string you want to guess :')
m= int(m)
a = string.ascii_lowercase
b = ''.join(random.choice(a) for x in range(m))
print(b)
print ('now you can start guessing')
z = input ('input your guess :')

while  b != z:
        if len(b) != len(z):
                print(' please enter a guess with the same lenght')
                print(' *reminder: its a',m,'letters long')
                z = input ('input another guess :')
        else:
               for i in str(z) 
                print('you got $S pulls and $S hits')
                print(' Guess Again')
                z = input ('input another guess :')
else:
                print('nice guess')