jeudi 4 octobre 2018

Trying to roll double sixes on Python3 and telling me how many rolls it took

I'm very new to coding and I just wanted to roll a dice until it gets double sixes. But every time I run it, it tells me every roll I get are doubles? I wanted it to roll two random numbers. Here's my code...(I am very new to coding..)

import random
roll_value=0
roll_value= roll_value + 1
while True:
    throw_1 = random.randint(1,6)
    throw_2 = random.randint(1,6)
    total = throw_1 + throw_2
    if throw_1 == 6 and throw_2 ==6:
        total == 12
        print ('Double Six thrown! ' 'Dice rolled ' + str(roll_value) + ' times' + '...you win')
        break
    if (throw_1 == 1 and throw_2 == 1):
        total = throw_1 + throw_2
        print ('Double thrown!')
    if (throw_1 == 2 and throw_2 == 2):
        total = throw_1 and throw_2
        print ('Double thrown!')
    if (throw_1 == 3 and throw_2 == 3):
        total = throw_1 and throw_2
        print ('Double thrown!')
    if (throw_1 == 4 and throw_2 == 4):
        total = throw_1 and throw_2
        print ('Double thrown!')    
    if (throw_1 == 5 and throw_2 == 5):
        total = throw_1 and throw_2
        print ('Double thrown!') 




Aucun commentaire:

Enregistrer un commentaire