Skip to content

Commit fe2382d

Browse files
Dice roll number generator using if-elif-else and while loop (#35)
* A strong password generator is made * A strong password generator is made * A strong password generator is made * Simple dice roll simulator using while loop and if-elif-else
1 parent 86207dc commit fe2382d

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

Dicerollgenerator.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import random
2+
ch = "y"
3+
while ch == "y":
4+
a= random.randint(1,6) # random number is generated
5+
6+
if a== 1:
7+
print("[-----]")
8+
print("[ . ]")
9+
print("[ . . ]")
10+
print("[ . ]")
11+
print("[ . ]")
12+
print("[ ....]")
13+
print("[-----]")
14+
print("the number rolled is 1")
15+
elif a== 2:
16+
print("[-----]")
17+
print("[.....]")
18+
print("[ .]")
19+
print("[.....]")
20+
print("[. ]")
21+
print("[.....]")
22+
print("[-----]")
23+
print("the number rolled is 2")
24+
elif a== 3:
25+
print("[-----]")
26+
print("[.....]")
27+
print("[ .]")
28+
print("[.....]")
29+
print("[ .]")
30+
print("[.....]")
31+
print("[-----]")
32+
print("the number rolled is 3")
33+
elif a== 4:
34+
print("[-----]")
35+
print("[. .]")
36+
print("[. .]")
37+
print("[.....]")
38+
print("[ .]")
39+
print("[ .]")
40+
print("[-----]")
41+
print("the number rolled is 4")
42+
elif a== 5:
43+
print("[-----]")
44+
print("[.....]")
45+
print("[. ]")
46+
print("[.....]")
47+
print("[ .]")
48+
print("[.....]")
49+
print("[-----]")
50+
print("the number rolled is 5")
51+
else:
52+
print("[-----]")
53+
print("[.....]")
54+
print("[. ]")
55+
print("[.....]")
56+
print("[. .]")
57+
print("[.....]")
58+
print("[-----]")
59+
print("the number rolled is 6")
60+
61+
ch=input("press y if you want to continue and n to stop:")
62+
#if input y than while loop executes again

0 commit comments

Comments
 (0)