| 1 |
"""Small test script taken from https://wiki.python.org/moin/SimplePrograms""" |
| 2 |
|
| 3 |
import random |
| 4 |
import sys # F401 'os' imported but unused |
| 5 |
import os # F401 'os' imported but unused |
| 6 |
|
| 7 |
### E265 block comment should start with '# ' |
| 8 |
print("Hello from reviewdog!") |
| 9 |
print("Let's play a small number guessing game to test the flake8 github action.") |
| 10 |
print("This game is taken from https://wiki.python.org/moin/SimplePrograms.") |
| 11 |
|
| 12 |
guesses_made = 0 |
| 13 |
|
| 14 |
name = input("Hello! What is your name?\n") |
| 15 |
|
| 16 |
number = random.randint(1, 20) |
| 17 |
print("Well, {0}, I am thinking of a number between 1 and 20.".format(name)) # E501 line too long (80 > 79 characters) |
| 18 |
|
| 19 |
while guesses_made < 6: |
| 20 |
|
| 21 |
guess = int(input("Take a guess: ")) |
| 22 |
|
| 23 |
guesses_made += 1 |
| 24 |
|
| 25 |
if guess < number: |
| 26 |
print("Your guess is too low.") |
| 27 |
|
| 28 |
if guess > number: |
| 29 |
print("Your guess is too high.") |
| 30 |
|
| 31 |
if guess == number: |
| 32 |
break |
| 33 |
|
| 34 |
if guess == number: |
| 35 |
print( |
| 36 |
"Good job, {0}! You guessed my number in {1} guesses!".format( |
| 37 |
name, guesses_made |
| 38 |
) |
| 39 |
) |
| 40 |
else: |
| 41 |
print("Nope. The number I was thinking of was {0}".format(number)) |
| 42 |
|
| 43 |
import itertools # E402 module level import not at top of file |