#!/usr/bin/python

#
# fig04_07.py
# Roll a six-sided die 6000 times.
#
# Author: Billy Wilson Arante
# Created: 2016/08/06 PHT
#
# Attribution: Python How to Program, 1st Ed. by Deitel & Deitel
#

import random

def main():
    """Main"""

    # Initialize
    frequency1 = 0
    frequency2 = 0
    frequency3 = 0
    frequency4 = 0
    frequency5 = 0
    frequency6 = 0

    for roll in range(1, 6001):     # Rolls a die 6000 times
        face = random.randrange(1, 7)       # Random number from 1 to 7

        # Count frequencies

        if face == 1:
            frequency1 += 1
        elif face == 2:
            frequency2 += 1
        elif face == 3:
            frequency3 += 1
        elif face == 4:
            frequency4 += 1
        elif face == 5:
            frequency5 += 1
        elif face == 6:
            frequency6 += 1
        else:
            print "It should never get here!"

    print "%4s %13s" % ("Face", "Frequency")
    print "%4s %13s" % (1, frequency1)
    print "%4s %13s" % (2, frequency2)
    print "%4s %13s" % (3, frequency3)
    print "%4s %13s" % (4, frequency4)
    print "%4s %13s" % (5, frequency5)
    print "%4s %13s" % (6, frequency6)


if __name__ == "__main__":
    main()
