Course Solutions Uncategorized (Solved) : Make Codes Effieciently Want Make Computer Python Guess User Number Import Random Goodbye Q26596572 . . . .

(Solved) : Make Codes Effieciently Want Make Computer Python Guess User Number Import Random Goodbye Q26596572 . . . .

 

How to make this codes more effieciently? I want to makecomputer (python) to guess user number.

import random

goodbye=’Goodbyen’

while True:

    smaller =int(input(‘Enter the smaller number:’))
    larger =int(input(‘Enter the larger number:’))
    userNumber =int(input(‘Enter the numberthat youwant me to guess: ‘))
    count =0

    while True:
        count +=1
        myNumber=random.randint(smaller,larger)

        if userNumber >myNumber:
           print(myNumber)
           print(‘Too small n’)

        elif userNumber <myNumber:
           print(myNumber)
           print(‘Too large n’)

        else:
           print(‘I got it right in’,count,’tries! n’)
           break
       
    answer=input(‘Would you retry this program?Press enter to exit or any key to continue: ‘)

    if answer== ”:
        print(goodbye)
        break
    else:
        print()

As you can see, computer is generating new random number whichis not that efficient. How can I write codes so

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : 12 Find Number Times Following Loop Performed Mov R0 0x55 Mov R2 40 Ldr R1 10000000 Eor R0 Q36545087 . . . .(Solved) : 12 Find Number Times Following Loop Performed Mov R0 0x55 Mov R2 40 Ldr R1 10000000 Eor R0 Q36545087 . . . .

<br/><img src="https://media.cheggcdn.com/media%2Fb0a%2Fb0a46e11-8e5f-4c00-9b89-b11d6a189307%2Fimage.png" alt="12. Find the number of times the following loop is performed: MOV R0 , #0x55 MOV R2 , #40 LDR R1,=10000000 EOR R0 , R0 , #0xF" aria-describedby="d3f"/>12.