So Im writing a program that rolls two dice and then according to what is rolled, points are assigned and a running total is kept. So far I have this but I keep running into an error of "int is not calllable". Can someone please help!
import random
def dice():
a = 1
b = 6
return random.randint(a,b)
rollOne = int(dice())
rollTwo = int(dice())
def greeting():
option = input('Enter Y if you would like to roll the dice: ')
if option == 'Y':
print('You have rolled a' , rollOne, 'and a' , rollTwo)
points = []
if rollOne() == rollTwo():
points.append(10)
print('You have a total of %d points' % (sum(points)))
if rollOne == 6 or rollTwo ==6:
points.append(4)
print('You have a total of %d points' % (sum(points)))
if (rollOne + rollTwo) == 7:
points.append(2)
print('You have a total of %d points' % (sum(points)))
dice()
greeting()
Aucun commentaire:
Enregistrer un commentaire