Skip to content

Update Guess The Number program in Python #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Guess The Number program in Python
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ and you have limited attempts :

Source_Code ->

#Program : Guess the Number
'''Program : Guess the Number'''
num = 15
print("You have 8 attempts so let's guess the Correct Number !")
attempts = 8
for i in range(8):
for i in range(attempts):
no_of_attmepts_left = attempts
print("No. of attempts left ->", attempts)
i = int(input("Guess the Number : "))
if i == num:
print("Congrats! You Guess the Correct no.")
print("Congrats! You Guess the Correct Number, in ",(9-attempts), "attempt")
break
elif i < num:
print(i, "is greater than the Correct no. Try Again!")
else :
print(i, "is lesser than the Correct no. Try Again!")
else :
print(i, "is greater than the Correct no. Try Again!")
if no_of_attmepts_left == 1:
print("No more attempts left! if you want to try again then rerun the Program :)")
attempts = attempts - 1