Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fdf82d5

Browse files
Merge pull request avinashkranjan#244 from Ayush7614/master
Dice Roll Simulator
2 parents b772202 + 0f06cda commit fdf82d5

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

‎Dice Roll Simulator/README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### In this script we will create a classic rolling dice simulator with the help of basic Python knowledge. Here we will be using the random module since we randomize the dice simulator for random outputs.
2+
3+
### random.randint(): This function generates a random number in the given range.
4+
5+
### Below is the implementation.
6+
[Implementation](https://github.com/Ayush7614/Amazing-Python-Scripts/blob/master/Dice%20Roll%20Simulator/program.py)
7+

‎Dice Roll Simulator/program.py‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import random
2+
3+
4+
x = "y"
5+
6+
while x == "y":
7+
8+
# Gnenerates a random number
9+
# between 1 and 6 (including
10+
# both 1 and 6)
11+
no = random.randint(1,6)
12+
13+
if no == 1:
14+
print("[-----]")
15+
print("[ ]")
16+
print("[ 0 ]")
17+
print("[ ]")
18+
print("[-----]")
19+
if no == 2:
20+
print("[-----]")
21+
print("[ 0 ]")
22+
print("[ ]")
23+
print("[ 0 ]")
24+
print("[-----]")
25+
if no == 3:
26+
print("[-----]")
27+
print("[ ]")
28+
print("[0 0 0]")
29+
print("[ ]")
30+
print("[-----]")
31+
if no == 4:
32+
print("[-----]")
33+
print("[0 0]")
34+
print("[ ]")
35+
print("[0 0]")
36+
print("[-----]")
37+
if no == 5:
38+
print("[-----]")
39+
print("[0 0]")
40+
print("[ 0 ]")
41+
print("[0 0]")
42+
print("[-----]")
43+
if no == 6:
44+
print("[-----]")
45+
print("[0 0 0]")
46+
print("[ ]")
47+
print("[0 0 0]")
48+
print("[-----]")
49+
50+
x=input("press y to roll again and n to exit:")
51+
print("\n")
52+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /