Skip to content

Commit 415c5cb

Browse files
authored
Update user_input_example.py
Used f-strings for string interpolation
1 parent de36639 commit 415c5cb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

python-break/user_input_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
while True:
1010
if guesses_left <= 0:
1111
print(
12-
"You ran out of guesses! The correct number was "
13-
+ str(random_number)
12+
f"You ran out of guesses! The correct number was {random_number}"
1413
)
1514
break
1615
guess = input("Guess a number between 1 and 10, or enter q to quit:")
@@ -26,4 +25,4 @@
2625
else:
2726
print("Sorry, your guess was incorrect.")
2827
guesses_left -= 1
29-
print("You have " + str(guesses_left) + " guesses left.")
28+
print(f"You have {guesses_left} guesses left.")

0 commit comments

Comments
 (0)