Combine your Game1 program (the guessing game) with the graphics program I posted. Your "windows" program should display a window and ask the user to guess the number, accept the guess from the user, and then display the appropriate response to the guess. Game 1 #Import module import random #Generate random number n=int(random.randint(1,10)) #Prompt the user to guess a number print("Guess a number : ") #Get the guess from the user guess=int(input()) #Check if both are equal if guess==n: #Print the message print("Success!!!") else: #Print the message print("Sorry") Graphics code: Listing of my Window.300.by.400 program: # This shows how to output strings to the graphics window # and get user input # # basic steps # create and use a Text object to output the label / prompt # create and use an Entry object to allow the user to type # put some text into the Entry object (setText) # use a getMouse to pause until user clicks # use getText to get the input from the Entry object # process input as desired from graphics import * def main(): win = GraphWin("Sample Input", 300, 400) win.setCoords(0,0, 299, 399) # not required, just convenient    upleft= Text(Point(50, 350),"50, 350") upleft.setStyle('bold italic') # not required, just convenient upleft.draw(win)    upright= Text(Point(250, 350),"350, 350") upright.setStyle('bold italic') # not required, just convenient upright.draw(win)    downleft= Text(Point(50, 50),"50, 50") downleft.setStyle('bold italic') # not required, just convenient downleft.draw(win)    downright= Text(Point(250, 50),"350, 50") downright.setStyle('bold italic') # not required, just convenient downright.draw(win) prompt = Text(Point(150, 50),"Click to end") prompt.draw(win) win.getMouse() win.close() main()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Combine your Game1 program (the guessing game) with the graphics program I posted. Your "windows" program should display a window and ask the user to guess the number, accept the guess from the user, and then display the appropriate response to the guess.

Game 1

#Import module

import random

#Generate random number

n=int(random.randint(1,10))

#Prompt the user to guess a number

print("Guess a number : ")

#Get the guess from the user

guess=int(input())

#Check if both are equal

if guess==n:

#Print the message

print("Success!!!")

else:

#Print the message

print("Sorry")

Graphics code:


Listing of my Window.300.by.400 program:

# This shows how to output strings to the graphics window

# and get user input

#

# basic steps

# create and use a Text object to output the label / prompt

# create and use an Entry object to allow the user to type

# put some text into the Entry object (setText)

# use a getMouse to pause until user clicks

# use getText to get the input from the Entry object

# process input as desired

from graphics import *

def main():

win = GraphWin("Sample Input", 300, 400)

win.setCoords(0,0, 299, 399) # not required, just convenient
  
upleft= Text(Point(50, 350),"50, 350")

upleft.setStyle('bold italic') # not required, just convenient

upleft.draw(win)
  

upright= Text(Point(250, 350),"350, 350")

upright.setStyle('bold italic') # not required, just convenient

upright.draw(win)
  

downleft= Text(Point(50, 50),"50, 50")

downleft.setStyle('bold italic') # not required, just convenient

downleft.draw(win)
  

downright= Text(Point(250, 50),"350, 50")

downright.setStyle('bold italic') # not required, just convenient

downright.draw(win)


prompt = Text(Point(150, 50),"Click to end")

prompt.draw(win)

win.getMouse()

win.close()

main()

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education