I wrote a code snippet to draw a bit of 'abstract art': yertle.penDown(); yertle.forward(10); yertle.right(Math.PI/2); yertle.forward(10); yertle.right(Math.PI/2); yertle.forward(10); yertle.right(Math.PI/2); yertle.forward(10); yertle.right(Math.PI/2); yertle.left(Math.PI/2); yertle.forward(20); yertle.right(Math.PI/2); yertle.forward(20); yertle.right(Math.PI/2); yertle.forward(20); yertle.right(Math.PI/2); yertle.forward(20); yertle.right(Math.PI/2); yertle.left(Math.PI/2); yertle.forward(30); yertle.right(Math.PI/2); yertle.forward(30); yertle.right(Math.PI/2); yertle.forward(30); yertle.right(Math.PI/2); yertle.forward(30); yertle.right(Math.PI/2); yertle.left(Math.PI/2); yertle.forward(40); yertle.right(Math.PI/2); yertle.forward(40); yertle.right(Math.PI/2); yertle.forward(40); yertle.right(Math.PI/2); yertle.forward(40); yertle.right(Math.PI/2); yertle.left(Math.PI/2); yertle.penUp(); My instructor suggested I...

80.2K

Verified Solution

Question

Programming

I wrote a code snippet to draw a bit of 'abstract art':

yertle.penDown();yertle.forward(10);yertle.right(Math.PI/2);yertle.forward(10);yertle.right(Math.PI/2);yertle.forward(10);yertle.right(Math.PI/2);yertle.forward(10);yertle.right(Math.PI/2);yertle.left(Math.PI/2);yertle.forward(20);yertle.right(Math.PI/2);yertle.forward(20);yertle.right(Math.PI/2);yertle.forward(20);yertle.right(Math.PI/2);yertle.forward(20);yertle.right(Math.PI/2);yertle.left(Math.PI/2);yertle.forward(30);yertle.right(Math.PI/2);yertle.forward(30);yertle.right(Math.PI/2);yertle.forward(30);yertle.right(Math.PI/2);yertle.forward(30);yertle.right(Math.PI/2);yertle.left(Math.PI/2);yertle.forward(40);yertle.right(Math.PI/2);yertle.forward(40);yertle.right(Math.PI/2);yertle.forward(40);yertle.right(Math.PI/2);yertle.forward(40);yertle.right(Math.PI/2);yertle.left(Math.PI/2);yertle.penUp();

My instructor suggested I could get the same result from amuch shorter program, but I don't see how.
What should I write instead?
(Keep it concise, and don't include anything outside the scope ofthe question)

Answer & Explanation Solved by verified expert
3.8 Ratings (582 Votes)
yesthis seems a pretty long code the thing you want to do can bedone with much lesser stepsi can see from the code that you are running similar lines ofcode many timeslike    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students