Skip to content

Instantly share code, notes, and snippets.

@prkagrawal
Last active June 20, 2020 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prkagrawal/edce1931f52032b43daac837210c3642 to your computer and use it in GitHub Desktop.
Save prkagrawal/edce1931f52032b43daac837210c3642 to your computer and use it in GitHub Desktop.
import random
t = str(random.randint(1000,9999))
def check():
k = str(input("Enter a four digit number : "))
if k == t:
print("Correct : Game Over")
return
elif k != t:
for a in range(4):
if k[a]==t[a]:
print("cow")
elif k[a] != t[a]:
print("bull")
return check()
check()
# Anyone can complete this game in maximum 10 turns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment