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

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter2: Elements Of High-quality Programs
Section: Chapter Questions
Problem 1GZ
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,