Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def tarkistus(merkkijono):
- if len(merkkijono) != 4:
- print "Use 4 symbols!"
- return False
- else:
- for i in range(4):
- if merkkijono[i] not in "123456":
- print "Invalid symbol! Use numbers between 1-6!"
- return False
- return True
- if len(sys.argv) == 1:
- print "Give secret code"
- sys.exit()
- koodi = sys.argv[1]
- if tarkistus(koodi) == True:
- while True:
- arvaus = raw_input("Give guess: ")
- if arvaus == koodi:
- print "You win!"
- print "the correct answer was", koodi
- break
- elif tarkistus(arvaus) == True:
- for i in range(4):
- if koodi[i] == arvaus[i]:
- print "Symbol in correct position"
- elif arvaus[i] in koodi:
- print "Correct symbol"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement