More Practice with Python

Dice Roll

This is the simplest of the programs but it was

#! python3
#diceRoll.py

import random, logging

#Sets up logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s.%(msecs)03d: %(message)s', datefmt='%H:%M:%S')
#logging.disable(logging.DEBUG) # uncomment to block debug logging.debug messages
#logging.disable(logging.INFO) # uncomment to block debug logging.info messages and below

def diceRoll():
    print('This program outputs a random dice roll.\n')

    nextRoll = True # Sets local variable that determines if the dice should be rolled again
    rollNum_list = [] # list holding all the past rolls

    try:
        print('Choose number of sides on dice: ') # prompts user to enter the number of sides on the dice
        sidesNum = int(input())
        logging.debug('User selected dice sides: %d' % sidesNum)

        while nextRoll == True:

            roll = random.randint(1,sidesNum) # Generates random number for dice roll
            print('\nYou rolled a %d' % roll) # prints results
            rollNum_list.append(roll)

            print("\tWould you like to roll the dice again?") # ask if user would like to make another roll
            userContinueInput = input() # gets input
            logging.debug('userContinueInput = %s' % userContinueInput)

            while userContinueInput != 'n' and userContinueInput != 'y': # checks that user input is valid
                print("ERROR: You must input either 'y' or 'n'") #
                userContinueInput = input()

            if userContinueInput == 'n': # exits program if user inputs string 'n'
                nextRoll = False

        print(rollNum_list)
        print('DONE: EXITING PROGRAM ')

    except ValueError:
        print('\nERROR: You must input an interger value')

#Main Call
if __name__ == '__main__':
    diceRoll()