from random import randint
rolls = []
for i in range(5):
roll = (randint(1,6))
rolls.append(roll)
print(rolls)
rolls =
counts = []
for i in range(1,7):
counts.append(rolls.count(i))
counts = [1,1,1,1,2,0]
def checkforsmallstraight(counts):
case1 = (counts[0] > 0) and (counts[1] >0) and (counts[2] > 0) and (counts[3] > 0)
case2 = (counts[1] > 0) and (counts[2] >0) and (counts[3] > 0) and (counts[4] > 0)
case3 = (counts[2] > 0) and (counts[3] >0) and (counts[4] > 0) and (counts[5] > 0)
if 5 in counts:
print('Yahtzee! *50pts* ')
if 4 in counts:
print(f'Four of a kind! *{sum(rolls)}pts*')
if 3 in counts:
print (f'Three of a kind! *{sum(rolls)}pts* ')
if 2 in counts:
print('Full House!*25pts*')
if (max(counts) == 1) and ((counts[0] == 0) or (counts[-1] == 0)):
print('Long Straight *40pts*')
if checkforsmallstraight(counts):
print ('Short straight! *30pts*')
print ('Chance')
Comments
Displaying 0 of 0 comments ( View all | Add Comment )