My python sol :
def play_greed(): score = [random.randint(1, 6) for _ in range(5)] count = [score.count(i) for i in range(1, 6+1)] points = 0 if count[0] < 3: points += 100 * count[0] elif count[0] == 3: points += 1000 if count[4] < 3: points+= 50 * count[4] elif count[4] == 3: points += 500 if count[1] == 3: points += 200 elif count[2] == 3 : points += 300 elif count[3] == 3 : points += 400 elif count[5] == 3 : points += 600 return points
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My python sol :