Python Projects: Guess a number that has randomly selected
Python Project-3 with Solution
Create a Python project to guess a number that has randomly selected.
Sample Solution -1 :
Python Code:
Sample Output:
Welcome to Number Guess Please input a number between 0 and 100:6 This is lower than actual number. Please try again. Please input a number between 0 and 100:25 This is higher than actual number. Please try again. Please input a number between 0 and 100:15 This is higher than actual number. Please try again. Please input a number between 0 and 100:10 This is lower than actual number. Please try again. Please input a number between 0 and 100:11 This is lower than actual number. Please try again. Please input a number between 0 and 100:123 This is higher than actual number. Please try again. Please input a number between 0 and 100:12 This is the correct number Thank you for playing Number Guess. See you again
Flowchart:

Sample Solution -2 :
You get 6 chances to guess the number that computer has randomly selected from 1 to 100.
Python Code:
Sample Output:
Please Enter your name: Jhon Mick Welcome to my Number game, Jhon Mick I have selected a number between 1 to 100... You have 6 chances to guess that number... Enter your number: 15 Jhon Mick, My number is greater than your guessed number you now have 5 chances left Enter your number: 12 Jhon Mick, My number is greater than your guessed number you now have 4 chances left Enter your number: 10 Jhon Mick, My number is greater than your guessed number you now have 3 chances left Enter your number: 25 Jhon Mick, My number is greater than your guessed number you now have 2 chances left Enter your number: 16 Jhon Mick, My number is greater than your guessed number you now have 1 chances left Enter your number: 35 Jhon Mick, My number is greater than your guessed number you now have 0 chances left Sorry you lost the game!! My number was = 78 Do you wish to play again?(y/n):
Flowchart:

Sample Solution -3 :
Python Code:
Sample Output:
Hello! What is your name? Jhon Mick Well, Jhon Mick, I am thinking of a number between 1 and 20. Take a guess. 15 Your guess is too low. Take a guess. 12 Your guess is too low. Take a guess. 19 Your guess is too high. Take a guess. 16 Your guess is too low. Take a guess. 18 Your guess is too high. Take a guess. 17 Good job, Jhon Mick! You guessed my number in 6 guesses!
Flowchart:

Sample Solution -4 :
Python Code:
Sample Output:
Hello, welcome to Guess Number! Ready to play...? Press Y to start game, or X to quit. y The number will be from an inclusive range of 0 to 1000 Please enter your guess: 250 Sorry, you didn't guess the number Your guess was low What's your next guess? 568 Sorry, you didn't guess the number Your guess was low What's your next guess? 879 Your guess was high What's your next guess? 735 Sorry, you didn't guess the number Your guess was high What's your next guess? 655 Sorry, you didn't guess the number Your guess was high What's your next guess? 539 Sorry, you didn't guess the number Your guess was low What's your next guess? 590 Sorry, you didn't guess the number Your guess was low What's your next guess? 600 Sorry, you didn't guess the number Your guess was low What's your next guess? 665 Your guess was high What's your next guess? 635 Sorry, you didn't guess the number Your guess was low What's your next guess? 645 Congratulations! you guessed the number. Returning you to the menu... Hello, welcome to Guess Number!
Flowchart:

Improve this sample solutions and post your code through Disqus