Multi Stage Guessing Game with Scoring Feature in Python

"Multi Stage Guessing Game and Points"
Create a three stage guessing game with point scoring in each stage the user must guess the secret number in five attempts. Range of Secret number should be increased at stage like 1 to 10 in stage in 1, 1 to 20 in stage 2 and 1 to 30 in stage 3. If the user correctly guessed the secret number, the system should display "your guess is correct" and moves to next stage; otherwise, it should tell the user whether the guessed number is higher or lower than the secret number and proceed to the next attempt. If the user fails to guess correctly after five attempts, the game should end with the message "Game Over, You Lose the Game." If user successfully guessed in all the three stages, display "You won the Game with scored points" and stops the game.

At each stage the points will be awarded to user based on following condition

Solved in points
first attempt100
second attempt75
third attempt50
fourth attempt25
fifth attempt10

Hint : Sequence Type (list) is needed for this.
Objective : To learn the declaration and usage of list.

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#write your code here

Program or Solution

				
				
					
#hashed lines are comment lines used to illustrate the program
#import the built in method randint to generate an automatic secret number
from random import randint
# intiate level or stage as 1
level = 1
#sequence type to store points
points = [100,75,50,25,10]
#initial score is zeero
points_scored = 0
#loop for 3stages
while level <= 3:
#complexity range for each stage
end_value = level * 10
#secret number generation
secret_number = randint(1,end_value)
#looping statment for 5 attempts at each stage
for counter in range(0,5):
#gets the guessing number as user input
guess_number = int(input("Guess the secret number between 1 and {} ({} attempts left):".format(end_value,5-counter)))
#check guessing number is correct or higher or lower
if secret_number == guess_number:
print("Your Guess is Correct, You Won the level {} with {} points".format(level,points[counter]))
points_scored += points[counter]
level = level + 1
break
elif guess_number < secret_number:
print("Your Guess is lower than secret number")
else:
print("Your Guess is higher than secret number")
else:#else of for statement
print("Game Over, You Loose the Game, secret number is {}".format(secret_number))
break
else:#else of while statement
print("Congratz, You Won the Game with {} !!!".format(points_scored))

Program Explanation

Logic is same as previous level, in addition to that 

in line 10 a list is maintained with points for each number of attempt,

in line 23 we are adding the score from points based on number of attempts (counter variable) 

finally displaying the total score.

Comments