# plz help me finish these last two questions for computer science :( Using Python v2 The Lesson: Functions & Turtles There are many…

Thebrainywriters.com stands as the unrivaled pinnacle of homework help services. With a team of expert writers, comprehensive subject coverage, a commitment to academic integrity, punctual delivery, 24/7 support, confidentiality, affordability, and a track record of triumphant testimonials, it has established itself as the go-to platform for students seeking excellence in their academic endeavors. As the educational landscape continues to evolve, Thebrainywriters.com remains an indispensable ally for students worldwide, guiding them towards academic success and a brighter future.

plz help me finish these last two questions for computer science 🙁 Using Python v2 The Lesson: Functions & Turtles There are many ways to do graphics in Python, using the “turtle” module is one of the easiest. Turtle graphics are a fun way to review the use of functions. Load the code below into Wing and see what happens: # This program will draw an angled line import turtle turtle.color(“blue”) # colour will be blue turtle.up() # pick up the pen turtle.setx(0) # put the x coordinate of the pen at 0 turtle.sety(0) # put the y coordinate of the pen at 0 turtle.down() # put the pen down deg = 45 turtle.right(deg) # turn right the specified number of degrees turtle.forward(200) # move the turtle forward a distance of 200 turtle.up() # pick up the pen turtle.goto(-150,-120) # go to this coordinate position turtle.color(“red”) # change the colour turtle.write(“Done!”) # print the Done message. You will see that a line is drawn in the “turtle” window. > setx and sety represent the horizontal and vertical axes > the turtle.color function can either take 3 arguments (red, green, blue – each a floating point value between the value of 0 and 1 to represent a specific shade of colour) or a value of “red”, “green”, or “blue”. > For the other turtle functions see the associated comments What if we want to draw additional lines? This is where the use of functions can be very useful. Rather than retyping the code over and over, we could just pass parameters to a function, and get different colours and line orientations. See the example below: # This program will draw an angled line import turtle def draw_angled_line(): turtle.color(“blue”) # colour will be blue turtle.up() # pick up the pen turtle.setx(0) # put the x coordinate of the pen at 0 turtle.sety(0) # put the y coordinate of the pen at 0 turtle.down() # put the pen down deg = 45 turtle.right(deg) # turn right the specified number of degrees turtle.forward(200) # move the turtle forward a distance of 200 turtle.up() # pick up the pen turtle.goto(-150,-120) # go to this coordinate position turtle.color(“red”) # change the colour turtle.write(“Done!”) # print the Done message. draw_angled_line() What is the problem with this? Let’s fix it! # This program will draw an angled line import turtle def draw_angled_line(x, y): turtle.color(“blue”) # colour will be blue turtle.up() # pick up the pen turtle.setx(x) # put the x coordinate of the pen at 0 turtle.sety(y) # put the y coordinate of the pen at 0 turtle.down() # put the pen down deg = 45 turtle.right(deg) # turn right the specified number of degrees turtle.forward(200) # move the turtle forward a distance of 200 turtle.up() # pick up the pen turtle.goto(-150,-120) # go to this coordinate position turtle.color(“red”) # change the colour turtle.write(“Done!”) # print the Done message. draw_angled_line(0, 0) draw_angled_line(20,20) Note how x and y parameters are passed to the function. Recalling this function with diffierent parameters will only require one additional line of code for each line drawn on the screen. We can make this function easier to write by using one command at the top of your file from turtle import * . This command has the Python interpreter think that all of the turtle function definitions are in your program so it does not have to go out and find the turtle module somewhere else. Here’s how to do it: # This program will draw an angled line from turtle import * def draw_angled_line(x, y, r, g, b): color(r, g, b) # set the colour up() # pick up the pen setx(x) # put the x coordinate of the pen at 0 sety(y) # put the y coordinate of the pen at 0 down() # put the pen down deg = 45 right(deg) # turn right the specified number of degrees forward(200) # move the turtle forward a distance of 200 up() # pick up the pen goto(-150,-120) # go to this coordinate position color(“red”) # change the colour write(“Done!”) # print the Done message. draw_angled_line(0, 0, 0,1,0) # begins at (0,0), colour is green draw_angled_line(20,20, 0, 0.5, 0.5) # begins at (20,20), colour is a mix of green and blue Turtle Function Description color(val) Sets the colour of the pen up() Lifts the pen up(so no colour shows on the screen) down() Puts the pen down on the screen setx(val) Positions the pen’s x position sety(val) Positions the pen’s y position right(degree) Turns right the specified number of degrees forward(val) Move forward a distance specified by val goto(x) Go to the coordinate specified by (x,y) write(string) Print out string onto the screen The Assignments: 3. Using turtle graphics function example above (without the height variable): a) Create a square by passing the appropriate parameters. Make each side of the square a different color. b) Create a triangle by passing the appropriate parameters. 4. Using turtle graphics define two functions to create the following shapes: draw_star(): define a function to draw 8 lines at equally spaced angles in the 4 quadrants of the Cartesian plane (45 degrees apart from each other). (Hint: use a for loop) draw_square_patterns(): define a function to draw 8 squares shifted at a 45 degree angle from each other. (Hint: use a for loop)

Academic integrity is non-negotiable, and Thebrainywriters.com takes this principle to heart. Recognizing the significance of originality, the website guarantees that every assignment and paper is crafted from scratch. A strict anti-plagiarism policy and state-of-the-art plagiarism detection tools ensure that students receive unique and authentic content, giving them the confidence to submit their work without any concern. Time is of the essence in the academic realm, and Thebrainywriters.com understands the importance of meeting deadlines. Their unwavering commitment to punctuality ensures that students receive their completed assignments well before the submission date. This punctuality not only alleviates the stress of last-minute rushes but also allows students ample time for review and revision, promoting a deeper understanding of the subject matter. Recognizing that academic emergencies can arise at any hour, Thebrainywriters.com offers round-the-clock customer support. Students can rest assured that their queries and concerns will receive swift and attentive responses, regardless of the time zone they reside in. This dedication to customer care builds trust and fosters a supportive relationship between the website and its users.