<jupyter_start><jupyter_text>Now You Code 4: Guess A NumberWrite a program to play the classic "Guess a number" game.In this game the computer selects a random number between 1 and 10.It's your job to guess the number. Whenever you guess, the computer willgive you a hint of higher or lower. This process repeats until you guessthe number, after which the computer reports the number of guesses it took you.```For Example:I'm thinking of a number between 1 and 10...Your guess: 5Too low. Guess higher.Your guess: 7Too high. Guess lower.Your guess: 6You guessed it in 3 tries.```Your loop should continue until your input guess equals thecomputer generated random number. How do you make Python generate a random number?<jupyter_code># Sample code which demostrates how to generate a number between 1 and 10
import random 
number = random.randint(1,10)
print(number)<jupyter_output><empty_output><jupyter_text>Run the cell above a couple of times. Notice how each time you execute the code, it comes up with a different number. Here's a breakdown of the code```line 1 imports the random moduleline 2 randomly selects an integer between 1 and 10line 3 prints the number```Now that you understand how to generate a random number, try to design then write code for the program. The first step in your program should be to generate the random number.  Step 1: Problem Analysis Inputs:I'm thinking of a number between 1 and 10, what is it?Outputs:too high, too low, you got it!Algorithm (Steps in Program):print im thinking of a number between 1 and 10, what is it? output whether it is too big, too small or just right.<jupyter_code># Step 2: write code for program
import random
random= random.randint(1,10)
while True:
    number= int(input("im thinking of a number between 1 and 10, what number am I thinking of?"))
    if (random > number):
        print("nope, too low, try again.")
    if(random < number):
        print("nope, too high, try again.")
    if (number==random):
        print("you got it! nice job!")
        break<jupyter_output>im thinking of a number between 1 and 10, what number am I thinking of?4
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?6
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?7
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?8
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?9
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?7
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?5
nope, too low, try again.
im thinking of a number between 1 and 10, what number am I thinking of?10
you got it! nice job!
{'fraction_non_alphanumeric': 0.06141899046946699, 'fraction_numerical': 0.024708789269325803, 'mean_word_length': 4.152727272727272, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '208119', 'license': 'MIT', 'n_tokens_mistral': 839, 'n_tokens_neox': 765, 'n_words': 467, 'path': 'content/lessons/04/Now-You-Code/NYC4-Guess-A-Number.ipynb', 'repo_name': 'MahopacHS/spring-2020-neubauerc', 'size': '2833'}