Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This is myGuessGame using Python.
- #Shout out to onyenkuzi.com (Mr. SoL)! Lolz
- import random
- player = input("Welcome to my guessing game. What's your name?\n")
- print ('Hello '+player+', I am thinking of a number between 1 and 15\n')
- print("The challenge is to guess the number in 5 trials. Can you do this?")
- respond = input("Enter yes or y to start\n:")
- if respond == 'yes' or respond == 'y':
- print("Good, Let's start")
- trials = 0
- number = random.randint(1,15)
- while trials < 5:
- print('Take a guess: ')
- print()
- guess = int (input())
- trials = trials+1
- if guess < number:
- print('Your Guess is LOW, try a higher number')
- if guess > number:
- print('Your Guess is HIGH, try a lower number')
- if guess == number:
- break
- if guess == number:
- points = (6 - trials)*20
- trials = str(trials)
- points = str(points)
- print('Congratulations '+player+ ',' 'YOU WON!!!. You guessed my number in ' +trials+' Trials')
- print()
- print ('Your score is '+points+'%')
- if guess != number:
- number = str(number)
- print ('Sorry ' +player+','' YOU LOST. The correct number is'+number)
- elif respond != 'Yes' or respond != 'y':
- print ('THANK YOU, SEE YOU NEXT TIME')
Add Comment
Please, Sign In to add comment