A random dice roller

So I was sitting in Barnes and Nobles this evening and I realized, "Hey, I have WiFi!". So I decided to knock off a day on my challenge and write something that would take less than 5 mins. I decided on after much thought (Much longer than it should of taken) to write a simple random dice roller. You know the type that every new programmer sits down and uses the random module fir the first time? Anyway, here it is.

#!/usr/bin/env python3
import random, os
print('This is a random dice picker press enter to begin.')
input()

def dice1():
    print("-----\n|   |\n| o |\n|   |\n-----")
def dice2():
    print("-----\n|o  |\n|   |\n|  o|\n-----")
def dice3():
    print("-----\n|o  |\n| o |\n|  o|\n-----")
def dice4():
    print("-----\n|o o|\n|   |\n|o o|\n-----\n")
def dice5():
    print("-----|o o|\n| o |\n|o o|\n-----")
def dice5():
    print("-----\n|o o|\n|o o|\n|o o|\n-----")

def roller():
    skee = random.randint(1, 5)

    if skee == 1:
        dice1()
    elif skee == 2:
        dice2()
    elif skee == 3:
        dice3()
    elif skee == 4:
        dice4()
    elif skee == 5:
        dice5()
def roll():
    inc = 0
    amount = int(input('How many rolls do you want?'))
    while inc < amount:
        roller()
        inc = inc + 1
    again = input('Would you like to roll again?')
    if again == 'yes':
        pass
    else:
        exit(0)

while True:
       roll()

Okay, as I said in last post, am, looking for a suggestions on what to write seeya!

Comments (2)

Mark's photo

You have two def dice5(): and can't throw 6

This could probably be a for loop instead: while inc < amount:, like for inc in range(amount):

Lazar's photo

Oh thanks so much! Probably an error while I was typing it in. 😛 I'll go and fix it right way.