From 5c3e1c2ed86b57838d16151e4d9c305eae565084 Mon Sep 17 00:00:00 2001 From: Ananyagra24 <155280507+Ananyagra24@users.noreply.github.com> Date: Sun, 12 May 2024 21:49:55 +0530 Subject: [PATCH 1/6] Create History --- contrib/History | 1 + 1 file changed, 1 insertion(+) create mode 100644 contrib/History diff --git a/contrib/History b/contrib/History new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/contrib/History @@ -0,0 +1 @@ + From b8e682d2fd427f8c76bde3bc30207cad327aec5d Mon Sep 17 00:00:00 2001 From: Ananyagra24 <155280507+Ananyagra24@users.noreply.github.com> Date: Mon, 13 May 2024 08:40:22 +0530 Subject: [PATCH 2/6] Delete contrib/History --- contrib/History | 1 - 1 file changed, 1 deletion(-) delete mode 100644 contrib/History diff --git a/contrib/History b/contrib/History deleted file mode 100644 index 8b13789..0000000 --- a/contrib/History +++ /dev/null @@ -1 +0,0 @@ - From 83809066303a7f962f2063d1613bad26f9776c1d Mon Sep 17 00:00:00 2001 From: Ananyagra24 <155280507+Ananyagra24@users.noreply.github.com> Date: Mon, 13 May 2024 21:10:18 +0530 Subject: [PATCH 3/6] Create dice_roller.md --- contrib/mini-projects/dice_roller.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 contrib/mini-projects/dice_roller.md diff --git a/contrib/mini-projects/dice_roller.md b/contrib/mini-projects/dice_roller.md new file mode 100644 index 0000000..c083934 --- /dev/null +++ b/contrib/mini-projects/dice_roller.md @@ -0,0 +1,19 @@ +``` +import random +def dice(): + dice_no = random.choice([1,2,3,4,5,6]) + return "You got " + str(dice_no) +def roll_dice(): + print("Hey Guys, you will now roll a single dice using Python!") + while True: + start=input("Type \'k\' to roll the dice: ").lower() + if start != 'k': + print("Invalid input. Please try again.") + continue + print(dice()) + roll_again = input("Do you want to reroll? (Yes/No): ").lower() + if roll_again != 'yes': + break + print("Thanks for rolling the dice.") +roll_dice() +``` From f8a67cf65dc3d70cf0a81a0cebd55770f0ffc728 Mon Sep 17 00:00:00 2001 From: Ananyagra24 <155280507+Ananyagra24@users.noreply.github.com> Date: Mon, 13 May 2024 21:11:01 +0530 Subject: [PATCH 4/6] Update index.md --- contrib/mini-projects/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/mini-projects/index.md b/contrib/mini-projects/index.md index 82596a2..f60b286 100644 --- a/contrib/mini-projects/index.md +++ b/contrib/mini-projects/index.md @@ -1,3 +1,3 @@ # List of sections -- [Section title](filename.md) +- [Dice Roller](dice_roller.md) From 4be728eb4764637fa8072aeebcaa9965e619d578 Mon Sep 17 00:00:00 2001 From: Ananyagra24 <155280507+Ananyagra24@users.noreply.github.com> Date: Sun, 19 May 2024 09:44:37 +0530 Subject: [PATCH 5/6] Update dice_roller.md --- contrib/mini-projects/dice_roller.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/mini-projects/dice_roller.md b/contrib/mini-projects/dice_roller.md index c083934..6e1b793 100644 --- a/contrib/mini-projects/dice_roller.md +++ b/contrib/mini-projects/dice_roller.md @@ -1,8 +1,15 @@ +Dice Roller +
+The aim of this project is to replicate a dice and generate a random number from the numbers 1 to 6.

+For this first we will import the random library which will help make random choices. ``` import random def dice(): dice_no = random.choice([1,2,3,4,5,6]) return "You got " + str(dice_no) +``` +The above snippet of code defines a function called "dice( )" which makes the random choice and returns the number that is generated. +``` def roll_dice(): print("Hey Guys, you will now roll a single dice using Python!") while True: @@ -17,3 +24,6 @@ def roll_dice(): print("Thanks for rolling the dice.") roll_dice() ``` +The above code defines a function called "roll_dice( )" which interacts with the user.
+It prompts the user to give an input and if the input is k,the code proceeds further to generate a random number or gives the message of invalid input and asks the user to try again.
+After the dice has been rolled once, the function asks the user whether they want a reroll in the form of a yes or no question.The dice is rolled again if the user gives 'yes' as an answer and exits the code if the user replies with anything other than yes. From 5e95059765b6cb99498c1302b94f68c8d5ee482c Mon Sep 17 00:00:00 2001 From: Ankit Mahato Date: Thu, 23 May 2024 02:57:11 +0530 Subject: [PATCH 6/6] Update dice_roller.md --- contrib/mini-projects/dice_roller.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/contrib/mini-projects/dice_roller.md b/contrib/mini-projects/dice_roller.md index 6e1b793..0f4e5f9 100644 --- a/contrib/mini-projects/dice_roller.md +++ b/contrib/mini-projects/dice_roller.md @@ -1,14 +1,18 @@ -Dice Roller -
-The aim of this project is to replicate a dice and generate a random number from the numbers 1 to 6.

+## Dice Roller + +The aim of this project is to replicate a dice and generate a random number from the numbers 1 to 6. + For this first we will import the random library which will help make random choices. + ``` import random def dice(): dice_no = random.choice([1,2,3,4,5,6]) return "You got " + str(dice_no) ``` -The above snippet of code defines a function called "dice( )" which makes the random choice and returns the number that is generated. + +The above snippet of code defines a function called `dice()` which makes the random choice and returns the number that is generated. + ``` def roll_dice(): print("Hey Guys, you will now roll a single dice using Python!") @@ -24,6 +28,9 @@ def roll_dice(): print("Thanks for rolling the dice.") roll_dice() ``` -The above code defines a function called "roll_dice( )" which interacts with the user.
-It prompts the user to give an input and if the input is k,the code proceeds further to generate a random number or gives the message of invalid input and asks the user to try again.
-After the dice has been rolled once, the function asks the user whether they want a reroll in the form of a yes or no question.The dice is rolled again if the user gives 'yes' as an answer and exits the code if the user replies with anything other than yes. + +The above code defines a function called `roll_dice()` which interacts with the user. + +It prompts the user to give an input and if the input is `k`,the code proceeds further to generate a random number or gives the message of invalid input and asks the user to try again. + +After the dice has been rolled once, the function asks the user whether they want a reroll in the form of a `yes` or `no` question. The dice is rolled again if the user gives `yes` as an answer and exits the code if the user replies with anything other than yes.