Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Topic Video
Question

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())

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education