write the full set of logic pseudocode include all abstractions and mainline logic of the given code below: Correct terminology used Declarations are made with data types create a file initial.py and write below code #import random module import random def point(): #random integer stored number = random.randint(1,100) print("please guess number:") print("%s number have you guessed"%number) print("if yes please enter yes else enter no") return number run above code create another file computer.py and write below code #import random library for generating 1-100 import random import initial #define main function def main(): #call module method number = initial.point() m = input() if(m=="yes"): return "computer win the game" #no elif(m=="no"): for i in range(6): print("guessing number was greater than or less than:") print("enter g for greater than:") print("enter l for less than:") #for greater or less o = input() if(o == 'g'): #generate random number again number = random.randint(number,100) print("%s number have you guessed"%number) #for yes or no p = input() if(p=="yes"): return "computer win the game after %s"+str(i+2) else: continue #condition for less than elif(o=='l'): number = random.randint(1,number) print("%s number have you guessed"%number) p = input() if(p=="yes"): return "computer win the game after %s"+str(i+1) else: continue else: print("please enter valid keyword") i -= 1 continue else: return "computer loss the game after 7 times:" #call main function print(main())
Please write the full set of logic pseudocode include all abstractions and mainline logic of the given code below:
Correct terminology used
Declarations are made with data types
create a file initial.py and write below code
#import random module
import random
def point():
#random integer stored
number = random.randint(1,100)
print("please guess number:")
print("%s number have you guessed"%number)
print("if yes please enter yes else enter no")
return number
run above code
create another file computer.py and write below code
#import random library for generating 1-100
import random
import initial
#define main function
def main():
#call module method
number = initial.point()
m = input()
if(m=="yes"):
return "computer win the game"
#no
elif(m=="no"):
for i in range(6):
print("guessing number was greater than or less than:")
print("enter g for greater than:")
print("enter l for less than:")
#for greater or less
o = input()
if(o == 'g'):
#generate random number again
number = random.randint(number,100)
print("%s number have you guessed"%number)
#for yes or no
p = input()
if(p=="yes"):
return "computer win the game after %s"+str(i+2)
else:
continue
#condition for less than
elif(o=='l'):
number = random.randint(1,number)
print("%s number have you guessed"%number)
p = input()
if(p=="yes"):
return "computer win the game after %s"+str(i+1)
else:
continue
else:
print("please enter valid keyword")
i -= 1
continue
else:
return "computer loss the game after 7 times:"
#call main function
print(main())
Trending now
This is a popular solution!
Step by step
Solved in 2 steps