Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I need help adjusting code already written to incorporate some other factors,

Question

I need help adjusting code already written to incorporate some other factors,

style=”color:rgb(45,59,69);”>I need to add a list that keeps track of all the numbers guessed and modularizes the code.

I also need to be able to input a number and see if the computer can guess it.

Below is the code I need to add the items to.

Please assist!

import random

Name=input(“Name: “)

Date=input(“Date: “)

def numberGuessingGame(myGuess, num):

if myGuess > num:

print(‘Too high’)

elif myGuess < num:

print(‘Too low’)

def main():

print(‘Welcome to my Guess the number program!’)

num = random.randint(1, 10)

count=0

while True:

print(‘nWho will guess the number?n1.Usern2.Computer’)

choice=input(‘=> ‘)

if choice==’1’:

guess_num=int(input(‘Please guess a number between 1 and 10: ‘))

numberGuessingGame(guess_num,num)

count=count+1

elif choice==’2’:

guess_num = random.randint(1, 10)

numberGuessingGame(guess_num,num)

count=count+1

else:

print(‘Wrong choice!’)

if guess_num == num:

print(‘You guessed it! It took’,count, ‘attempts’)

break

main()

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"