This repository was archived by the owner on May 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New number guessing game! #374
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
.replit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
language = "python3" | ||
run = "" |
19 changes: 19 additions & 0 deletions
projects/Simple_guessing_game/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#Simple guess the number game | ||
|
||
### Prerequisites | ||
|
||
Python installed locally on your computer | ||
|
||
### How to run script | ||
|
||
''' | ||
python guess_the_number.py | ||
''' | ||
|
||
The final result: | ||
|
||
A guessing game which you will need to guess the number | ||
|
||
## *Author name* | ||
|
||
Andrew Nguyen |
34 changes: 34 additions & 0 deletions
projects/Simple_guessing_game/guess_the_number.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import random | ||
|
||
number = random.randint(1,100) | ||
print("guess the number from 1-100") | ||
|
||
guess_number = 0 | ||
|
||
running = True | ||
|
||
while running: | ||
guess = float(input("guess the number: ")) | ||
if guess > number: | ||
print("your number is too big") | ||
elif guess < number: | ||
print("your number is too small") | ||
elif guess == number: | ||
running = False | ||
else: | ||
print("Invaild Input") | ||
guess_number += 1 | ||
|
||
|
||
|
||
|
||
|
||
|
||
if guess_number == 0: | ||
guess_number += 1 | ||
|
||
|
||
|
||
|
||
|
||
print("congrats you guessed the number it took you", guess_number, "guesses") |
Binary file added
projects/Simple_guessing_game/guessing game capture.PNG
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.