Guest User

rejosompython

a guest
Jun 25th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. #This is myGuessGame using Python.
  2. #Shout out to onyenkuzi.com (Mr. SoL)! Lolz
  3. import random
  4.  
  5. player = input("Welcome to my guessing game. What's your name?\n")
  6.  
  7. print ('Hello '+player+', I am thinking of a number between 1 and 15\n')
  8. print("The challenge is to guess the number in 5 trials. Can you do this?")
  9. respond = input("Enter yes or y to start\n:")
  10.  
  11. if respond == 'yes' or respond == 'y':
  12.     print("Good, Let's start")
  13.  
  14.     trials = 0
  15.     number = random.randint(1,15)
  16.  
  17.     while trials < 5:
  18.         print('Take a guess: ')
  19.         print()
  20.  
  21.         guess = int (input())
  22.  
  23.         trials = trials+1
  24.  
  25.         if guess < number:
  26.             print('Your Guess is LOW, try a higher number')
  27.  
  28.         if guess > number:
  29.             print('Your Guess is HIGH, try a lower number')
  30.  
  31.         if guess == number:
  32.             break
  33.  
  34.     if guess == number:
  35.         points = (6 - trials)*20
  36.         trials = str(trials)
  37.         points = str(points)
  38.         print('Congratulations '+player+ ',' 'YOU WON!!!. You guessed my number in ' +trials+' Trials')
  39.         print()
  40.         print ('Your score is '+points+'%')
  41.    
  42.     if guess != number:
  43.         number = str(number)
  44.         print ('Sorry ' +player+','' YOU LOST. The correct number is'+number)
  45.  
  46. elif respond != 'Yes' or respond != 'y':
  47.     print ('THANK YOU, SEE YOU NEXT TIME')
Add Comment
Please, Sign In to add comment