Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 375db50

Browse files
authored
update main.py
some changes
1 parent 8ff4719 commit 375db50

File tree

1 file changed

+3
-7
lines changed
  • projects/Number guessing game

1 file changed

+3
-7
lines changed

projects/Number guessing game/main.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# While loop to count the number
1919
# of chances
20-
while chances < 5:
20+
while True:
2121

2222
# Enter a number between 1 to 9
2323
guess = int(input())
@@ -31,7 +31,8 @@
3131
# number by randint function then
3232
# break from loop using loop
3333
# control statement "break"
34-
print("Congratulation YOU WON!!!")
34+
print(f'CONGRATULATIONS! YOU HAVE GUESSED THE NUMBER {number} IN {chances} ATTEMPTS!')
35+
#Printing final statement using the f-strings method;
3536
break
3637

3738
# Check if the user entered
@@ -49,8 +50,3 @@
4950
# Increase the value of chance by 1
5051
chances += 1
5152

52-
53-
# Check whether the user
54-
# guessed the correct number
55-
if not chances < 5:
56-
print("YOU LOSE!!! The number is", number)

0 commit comments

Comments
 (0)