The part I'm really wondering about is in the "if, elif, else" part. I set the variable to bring up the raw input thing so it would stay there long enough to read instead of just printing a response and closing the program right away. There must be a better way of doing this. An answer about that, and any other tips or suggestions would be greatly appreciated. This is my first program.
import random #Define rolling function. def rollDice(): #Set min and max levels for random. min = 1 max = 20 #Set variable to yes, then set up 'while' loop. rollAgain = 'yes' while rollAgain == 'yes' or rollAgain == 'y': print ('Sam rolled ' + str(random.randrange(min,max)) + '.') print ('Jeff rolled ' + str(random.randrange(min,max)) + '.') #Variable value is reset by user - loops to begining if answer is 'yes.' rollAgain = raw_input('Would you like to roll again?') #For looks. print ('------') '''If variable is set to 'no' variable is reset as raw_input so text response won't disappear.''' if rollAgain == 'no' or rollAgain == 'n': rollAgain == raw_input("Okay, I'm going home.") #First lines read, preface the function. yN = raw_input('You want to roll?') if yN == 'yes' or yN == 'y': print '------' rollDice() elif yN == 'no' or yN == 'n': yN == raw_input('Then why am I here?') else: yN == raw_input("I can't understand your sausage fingers, restart the program.")