Skip to content

Commit e77b053

Browse files
Merge pull request #2435 from avinashkranjan/deepsource-transform-5f068bd0
format code with autopep8
2 parents 17af3c4 + b20771e commit e77b053

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Guess the number/script.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import random
22

3+
34
def guess_the_number():
45
print("Welcome to Guess the Number Game!")
56
print("I'm thinking of a number between 1 and 100.")
6-
7+
78
secret_number = random.randint(1, 100)
89
attempts = 0
9-
10+
1011
while True:
1112
try:
1213
guess = int(input("Enter your guess: "))
1314
attempts += 1
14-
15+
1516
if guess == secret_number:
16-
print(f"Congratulations! You guessed the number in {attempts} attempts.")
17+
print(
18+
f"Congratulations! You guessed the number in {attempts} attempts.")
1719
break
1820
elif guess < secret_number:
1921
print("Too low! Try again.")
@@ -22,5 +24,6 @@ def guess_the_number():
2224
except ValueError:
2325
print("Invalid input. Please enter a valid number.")
2426

27+
2528
if __name__ == "__main__":
2629
guess_the_number()

0 commit comments

Comments
 (0)