Skip to content

Commit 0fa8682

Browse files
committed
.lower added to avoid repetition
1 parent 1111ffb commit 0fa8682

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

002 - Dice Roll/diceroll.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
print("**********************************")
66

77
while True:
8-
askuser = input("Do you want to roll the dice? (y/n): ")
9-
if (
10-
askuser == "y" or askuser == "Y" or askuser == "yes" or askuser == "Yes"
11-
): # Check both conditions separately
8+
askuser = input("Do you want to roll the dice? (y/n): ").lower()
9+
if askuser == "y" or askuser == "yes":
1210
print("Rolling...")
1311
time.sleep(1.5)
1412
num = random.randint(1, 6)
15-
print("You got", num)
16-
elif askuser == "n" or askuser == "N": # Check both conditions separately
17-
print("Not, cool!Goodbye!")
13+
print("You got", num, "!")
14+
elif askuser == "n" or askuser == "no":
15+
print("Not cool! Goodbye!")
1816
break
1917
else:
2018
print("Invalid input")

0 commit comments

Comments
 (0)