1 of 5

# I know there is a better way to store data, what is the most concise way to simplify this script?

from random import randint
from sys import exit
import os

os.system('clear')
print "Welcome to the dice rolling simulator!"
raw_input("Press enter to begin.")

total = 0

completed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

def roll():
os.system('clear')
die1 = randint(1, 6)
die2 = randint(1, 6)
global total
total = die1 + die2
storetotal()
print "Die 1: %d \nDie 2: %d \nTotal: %d." % (die1, die2, total)
print "\n\nRoll again?"
roll_again = raw_input("Press enter to roll again, type 'stats' to view scores, or 'quit' to exit.\n> ")
if roll_again == "":
roll()
elif roll_again == "stats":
stats()
elif roll_again == "quit":
exit(0)
else:
print "I don't know what that means so you get to roll again."
raw_input("> ")
roll()

def stats():
global total
print "2s: %d \n3s: %d \n4s: %d \n5s: %d \n6s: %d \n7s: %d \n8s: %d" % (completed,                                                                     completed, completed, completed,
completed, completed, completed)
print "9s: %d \n10s: %d \n11s: %d \n12s: %d""" % (completed, completed,
completed, completed)
raw_input("")
roll()

def storetotal():
if total == 2:
completed += 1
elif total == 3:
completed += 1
elif total == 4:
completed += 1
elif total == 5:
completed += 1
elif total == 6:
completed += 1
elif total == 7:
completed += 1
elif total == 8:
completed += 1
elif total == 9:
completed += 1
elif total == 10:
completed += 1
elif total == 11:
completed += 1
else:
completed += 1

roll()