Exercise 3- Valentine's Special [ Show some love (but don't get carried away) by writing a program (in Exercise3 in Replit) to get the robot to draw the well known shapes below: two intertwining hearts (..soaring away into the sunset...). Make sure the hearts are PINK IN COLOUR.

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
Exercise 2 - Primer on Loop
Referring to the code for drawing an equilateral triangle provided to you earlier in this prac
sheet, you may have noticed that, in order to draw the triangle, we are repeating a set of two
commands three times i.e. robot.forward( 100) followed by robotright(120). Python (and many other
programming languages) provide us a tool called a "Loop" to repeat a certain set of steps a
certain number of times. As usual, in order to use loops, we have learn the correct Python
syntax for it. The following Python code uses a loop to draw the same equilateral triangle as the
code provided earlier:
import turtle
wn - turtle.Screen()
wn.bgcolor("white"
robot - turtle. Turtle()
robot. setheading(90)
robot shape("turtle")
robot.colort"green"
robot. pensize(3)
for i in range(3):
robot. forward( 100)
robot. right(120)
wn.exitonclick()
Note that the lines that fall under the line that starts with "for" have to be indented; this means
that you have to insert spaces or tabs (USE TABS!), and the number of spaces or tabs for all
lines under the loop need to be the same. My advice: use only a single tab for each of these
lines.
Ok, now that we have this, try to use the above example to draw the following shape (noting that
the lengths of the sides can all be equal, say, 50 units). This should be done in the Exercise2
file provided in your Replit prac.
Exercise 3- Valentine's Special [
Show some love (but don't get carried away) by writing a program (in Exercise3 in Replit) to get
the robot to draw the well known shapes below: two intertwining hearts (..soaring away into the
sunset...). Make sure the hearts are PINK IN COLOUR.
Note that it is perfectly fine for your program to have lines within the hearts. What is important is
the outline. So if your shapes end up looking like the below, it will be fine too.
Transcribed Image Text:Exercise 2 - Primer on Loop Referring to the code for drawing an equilateral triangle provided to you earlier in this prac sheet, you may have noticed that, in order to draw the triangle, we are repeating a set of two commands three times i.e. robot.forward( 100) followed by robotright(120). Python (and many other programming languages) provide us a tool called a "Loop" to repeat a certain set of steps a certain number of times. As usual, in order to use loops, we have learn the correct Python syntax for it. The following Python code uses a loop to draw the same equilateral triangle as the code provided earlier: import turtle wn - turtle.Screen() wn.bgcolor("white" robot - turtle. Turtle() robot. setheading(90) robot shape("turtle") robot.colort"green" robot. pensize(3) for i in range(3): robot. forward( 100) robot. right(120) wn.exitonclick() Note that the lines that fall under the line that starts with "for" have to be indented; this means that you have to insert spaces or tabs (USE TABS!), and the number of spaces or tabs for all lines under the loop need to be the same. My advice: use only a single tab for each of these lines. Ok, now that we have this, try to use the above example to draw the following shape (noting that the lengths of the sides can all be equal, say, 50 units). This should be done in the Exercise2 file provided in your Replit prac. Exercise 3- Valentine's Special [ Show some love (but don't get carried away) by writing a program (in Exercise3 in Replit) to get the robot to draw the well known shapes below: two intertwining hearts (..soaring away into the sunset...). Make sure the hearts are PINK IN COLOUR. Note that it is perfectly fine for your program to have lines within the hearts. What is important is the outline. So if your shapes end up looking like the below, it will be fine too.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 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
  • SEE MORE 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