python dice rolling restart script
<p>i want to restart my script automatically i have a dice rolling script and i don't want to have to reset my script manually between each roll this is my script. </p>

<pre><code>import random
from random import randrange
from random import randint
r = randint
min = 1
max = 6

rolls = int(float(input('how menny times do you want to roll:')))

for x in range(rolls):
    print ('Rolling the dices...')
    print ('The value is....')
    print (r(min, max))
</code></pre>

<p>i have tried a few ways to do it but none of them worked</p>

<p>I'm not 100% sure what you were actually trying to do, but here is a program that I wrote that will roll 2 die at a time, and will generate however many rolls you would like to roll. -not the best practice to use recursive (main calls main from within itself), but it's not really an issue with something this basic.</p>

<p>*replace raw_input with input if you are using Python 3+. I use 2.7 so I use raw_input</p>

<pre><code>import time
import random

def roll_multiple():
#honestly this is all you need to do what you want to do, the rest just turns it into a game and allows multiple runs
    roll_number = int(raw_input("How Many Times Would You Like to Roll?\n"))
    for i in range(roll_number):
        print"You Rolled A ", random.randrange(1,6,1), " and a ", random.randrange(1,6,1)
#that's it! if you do these 3 lines, it will ask for how many times, and for each item in range of roll_number (whatever you input) it will run the print below and generate new numbers for each roll.

def main():
    print("Welcome to Craps 2.0")
    playing = raw_input("Press Enter to Roll or Q to quit")

    if playing == 'q':
        print("Thanks for Playing")
        time.sleep(2)
        quit()
    elif playing != 'q':
        roll_multiple()
        main()
main()
</code></pre>

python