Python(turtle) Use turtle graphics to draw a house! A house, should have: walls roof door 2-4 windows Sample house below Pseudo Code Function draw_window(x, y): (x, y passing location) Draw window without inner grid Draw inner grid of window Main Draw top and right side wall of house Draw bottom and door of house Draw left wall and roof Draw_window(x, y) – first location Draw_window(x, y) – second location Draw_window(x, y) – third location Provide the REPL weblink in the URL entry and submit the assignment.

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
Python(turtle) Use turtle graphics to draw a house! A house, should have: walls roof door 2-4 windows Sample house below Pseudo Code Function draw_window(x, y): (x, y passing location) Draw window without inner grid Draw inner grid of window Main Draw top and right side wall of house Draw bottom and door of house Draw left wall and roof Draw_window(x, y) – first location Draw_window(x, y) – second location Draw_window(x, y) – third location Provide the REPL weblink in the URL entry and submit the assignment.
Expert Solution
Step 1

Note: Follow proper indentation as specified in the code screenshot

Code:

# 1. get turtle library
import turtle

def Draw_House(pen):
    pen.width(4)
    pen.color(0,0,0)  
    pen.penup()
    pen.goto(-160,-20)
    pen.pendown()
    pen.setheading(90)
    pen.fillcolor("white")
    pen.begin_fill()
    pen.forward(200)
    roof1=pen.position()
    pen.right(90)
    pen.forward(300)
    roof2 = pen.position()
    pen.right(90)
    pen.forward(200)
    pen.right(90)
    pen.forward(175)
    door=pen.position()
    pen.forward(125)
    pen.right(90)
    pen.end_fill()
  
  #roof
    pen.penup()
    pen.goto(roof1)
    pen.begin_fill()
    pen.pendown()
    pen.goto(-10,260)
    pen.goto(roof2)
    pen.goto(roof1)
    pen.end_fill()
    pen.setheading(90)

  #door
    pen.penup()
    pen.goto(door)
    pen.begin_fill()
    pen.pendown()
    pen.forward(80)
    pen.right(90) 
    pen.forward(40)
    pen.right(90) 
    pen.forward(80)
    pen.right(90) 
    pen.forward(40)  
    pen.end_fill()

def Draw_Window(pen,x,y):
    pen.width(4)
    pen.color("black")
    pen.fillcolor("white")
    pen.penup()
    pen.goto(x,y)
    pen.pendown()
    pen.begin_fill()
    for y in range(4):
        for x in range(4):
            pen.forward(25)
            pen.right(90)
        pen.left(90)
    pen.end_fill()


if __name__ == "__main__":
    # 2. name your turtle
    pen = turtle.Turtle()
    screen = turtle.Screen()
    # 3. Set up your turtle
    pen.speed(100)
    pen.color(0,0,0)
    wn = turtle.Screen()
    #4. start drawing
    Draw_House(pen)
    Draw_Window(pen,-125,130)
    Draw_Window(pen,-15,130)
    Draw_Window(pen,100,130)
    screen.mainloop()
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Array
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