Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- n = 0
- amount_right_played = 0
- amount_right_color = 0
- code = [random.randint(0,5),random.randint(0,5),random.randint(0,5),random.randint(0,5)]
- while n <12 and amount_right_played < 4:
- amount_right_played = 0
- amount_right_color = 0
- number1 = int(raw_input('Eerste pion:? '))
- number2 = int(raw_input('Tweede pion:? '))
- number3 = int(raw_input('Derde pion:? '))
- number4 = int(raw_input('Vierde pion:? '))
- guess = [number1, number2, number3, number4]
- for i in range(4):
- if code[i]==guess[i]:
- amount_right_played = amount_right_played + 1
- for i in range(4):
- if code[i] in guess and not(code[i]==guess[i]):
- amount_right_color = amount_right_color + 1
- print code
- print guess
- print "Amount right color right place: %d" %(amount_right_played)
- print "Amount right color wrong place: %d" %(amount_right_color)
- if amount_right_played < 4:
- print "Try again"
- else:
- print "WIN!!"
- n += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement