dimanche 11 septembre 2016

If, elif loop not working properly? [duplicate]

This question already has an answer here:

Working on an assignment for my intro level computer programming class. Tasked with making a dice game similar to Yahtzee. Below is the scoring to the game and when running, it never gets past the first 'if' statement?

dice_counter is a list indexed from 0-6 and storing the values of the rolled dice.

   if (2 and 1) in dice_counter:
        print('Two pair +5pts')

    elif (3 and 1) in dice_counter:
        print('Three of a kind +10pts')

    elif (3 and 2) in dice_counter:
        print('Full house +15pts')

    elif (4 and 1) in dice_counter:
        print('Four of a kind +20pts')

    elif dice_counter == [0,0,1,1,1,1,1] or [0,1,1,1,1,1,0]:
        print('Straight +20pts')

    elif 5 in dice_counter:
        print('Five of a kind +30pts')

    else: break

Aucun commentaire:

Enregistrer un commentaire