Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- a = str(random.randint(1000,9999)) #3452
- print(a)
- count = 1
- def check_num():
- p = input("Enter input number: ")
- cows = bulls = 0
- for i in p:
- for j in a:
- if i==j:
- if a.find(i) == p.find(j):
- cows = cows+1
- else:
- bulls = bulls+1
- break
- else:
- continue
- print(cows, "cows", bulls, "bulls")
- return(cows)
- while int(check_num()) != 4:
- count = count+1
- print("Congratulations, you got the right number",a,"in",count,"tries.")
Add Comment
Please, Sign In to add comment