diff --git a/Roll-The-Dice/README.md b/Roll-The-Dice/README.md new file mode 100644 index 0000000..6338994 --- /dev/null +++ b/Roll-The-Dice/README.md @@ -0,0 +1,24 @@ +# Roll Dice Game for beginners +This program contains a simple 'Roll The Dice' game. +You can use this program when playing any board game with dice. + +Step 1. +Run the program by entering below commands in terminal. +``` +python main.py (in Windows) +``` +``` +python3 main.py (in Linux) +``` + +Step2. +Select Choice for getting the dice number. +``` +Roll (y/n): +``` +If you choose 'y' then the program will give you a random number between 1-6. +Otherwise, it will end. + +**_NOTE:_** : You can only get two times '6' consequently. + +Enjoy the Game...! \ No newline at end of file diff --git a/Roll-The-Dice/main.py b/Roll-The-Dice/main.py new file mode 100644 index 0000000..9c3ceb4 --- /dev/null +++ b/Roll-The-Dice/main.py @@ -0,0 +1,27 @@ +from numpy import random + +def get_num(): + num = random.randint(1,7) + return num + + +while True: + choice = input("Roll (y/n): ") + if choice == ("y" or "Y"): + num = get_num() + print(num) + print() + if num == 6: + print("Again Rolled: ") + num2 = get_num() + print(num2) + print() + + if num2 == 6: + print("Sorry you can only get 2 '6's") + print() + + else: + print("Program Exited... Bye !") + break +