-
Notifications
You must be signed in to change notification settings - Fork 0
/
diceRoller.py
39 lines (39 loc) · 1.04 KB
/
diceRoller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#Dice roll program
#This program rolls a virtual dice then shows you the number.
import random
import time
rollit=0
def roll():
global rollit
print("rolling...")
rollit=random.randint(1,6)
def show_dice():
global rollit
global s1
global s2
global s3
global s4
global s5
global s6
if rollit==1:
print("---------\n| |\n| O |\n| |\n---------\n")
elif rollit==2:
print("---------\n| O |\n| |\n| O |\n---------\n")
elif rollit==3:
print("---------\n| O |\n| O |\n| O |\n---------\n")
elif rollit==4:
print("---------\n| O O |\n| |\n| O O |\n---------\n")
elif rollit==5:
print("---------\n| O O |\n| O |\n| O O |\n---------\n")
elif rollit==6:
print("---------\n| O O |\n| O O |\n| O O |\n---------\n")
answer=input("again? ")
if answer=="yes":
roll()
if answer=="yes":
show_dice()
elif answer=="no":
print("fine.")
roll()
time.sleep(1)
show_dice()