Skip to content

Commit

Permalink
fix formatting & ads.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
mprat committed Nov 22, 2021
1 parent 2a5a3fe commit d122ae7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions _drafts/errorchecking.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## Exercise

Given this solution to Exercise 9, modify it to one level of user feedback: if the user does not enter a number between 1 and 9, tell them. Don't count this guess against the user when counting the number of guesses they used.

```
import random
number = random.randint(1, 9)
number_of_guesses = 0
while True:
guess = int(input("Guess a number between 1 and 9: "))
number_of_guesses += 1
if guess == number:
break
print(f"You needed {number_of_guesses} to guess the number {number}")
```


## Discussion

error checking on inputs
can use exercise8 as an example to walk through, since there are a lot of potential error checks
2 changes: 1 addition & 1 deletion _posts/2014-04-10-09-guessing-game-one-solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ categories: [solution]

{% include solution_header.md number=page.number %}

Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. (_Hint: remember to use the user input lessons from the very [first exercise]({% post_url 2014-01-29-01-character-input %}_)
Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. (_Hint: remember to use the user input lessons from the very [first exercise]({% post_url 2014-01-29-01-character-input %})_).

Extras:

Expand Down
1 change: 1 addition & 0 deletions ads.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google.com, pub-6567168629713427, DIRECT, f08c47fec0942fa0

0 comments on commit d122ae7

Please sign in to comment.