0% found this document useful (0 votes)
74 views1 page

Mastermind Pra Python

While the counter t is less than 11: - Print the attempt number and prompt the user for a guess - Compare the guess to the key digit by digit, counting matches - Print the number of correct and identical digits found - Increment the counter t and repeat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views1 page

Mastermind Pra Python

While the counter t is less than 11: - Print the attempt number and prompt the user for a guess - Compare the guess to the key digit by digit, counting matches - Print the number of correct and identical digits found - Increment the counter t and repeat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

while t<11:

print("Tentativa",t,end=" ")
chute = int(input(" .....:"))
chave = chaveA
chuteA = chute
ca = chute%10
c = 0
i = 0
p = 5
l = 5
while p>0:
print("**************************************ca antes",ca)
while l>0:
l -= 1
cb = chave%10
print("cb",cb)
if ca == cb:
print("***************o igual",cb)
c +=1
break
chave = chave//10
chute = chute//10
ca =chute%10
chave = chaveA
l = 5
p-=1
chute = chuteA
l = 5
while l>0:
print(l)
ca = chute%10
cb = chave%10
if ca == cb:
i += 1
chute = chute//10
chave = chave//10
l -= 1
print("certos",c,"identicos",i)
t += 1

You might also like