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[0],
completed[1], completed[2], completed[3],
completed[4], completed[5], completed[6])
print "9s: %d \n10s: %d \n11s: %d \n12s: %d""" % (completed[7], completed[8],
completed[9], completed[10])
raw_input("")
roll()
def storetotal():
if total == 2:
completed[0] += 1
elif total == 3:
completed[1] += 1
elif total == 4:
completed[2] += 1
elif total == 5:
completed[3] += 1
elif total == 6:
completed[4] += 1
elif total == 7:
completed[5] += 1
elif total == 8:
completed[6] += 1
elif total == 9:
completed[7] += 1
elif total == 10:
completed[8] += 1
elif total == 11:
completed[9] += 1
else:
completed[10] += 1
roll()