-
Notifications
You must be signed in to change notification settings - Fork 231
Expand file tree
/
Copy pathdice_game.py
More file actions
36 lines (29 loc) · 748 Bytes
/
dice_game.py
File metadata and controls
36 lines (29 loc) · 748 Bytes
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
import random
import time
def wait():
time.sleep(2.0)
print("*"*50)
print("Welcome to the Dice Game!")
print("A Game of Luck")
print("*"*50)
print("Roll the die and if you roll a lucky six; You Win! :)")
while (True):
user_input = input("Press 1 to role Die\n")
if(user_input == '1' or user_input == 1):
num = random.randint(1,6)
print("\nRolling the Die")
wait()
if(num == 6):
print("You got",num)
print("Yay! You won!\n")
else:
print("\nYou got",num,"\nAww! You Lost!\n")
choice = input("Press Y to Play again\nPress N to Exit Game\n")
if (choice == 'Y' or choice == 'y'):
continue
elif (choice == 'N' or choice == 'n'):
break
else:
print("\nPlease Enter Y/N.")
else:
print("\nNot a valid option")