Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction To complete this assignment, you will need to use the turtle and random modules. In addition, you will gain a deeper understanding of functions.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Introduction To complete this assignment, you will need to use the turtle and random modules. In addition, you will gain a deeper understanding of functions. Random Turtle Picture - 100 points In this assignment, you will modify this Python program (renamed according to the instructions above) so that it can be used to draw pictures such as this. Note: to see the full black border that surrounds the Python turtle graphics window, you will need to manually expand the window slightly. Requirements and Grading . 10 points - The correct number of turtles appear. 10 points - Each turtle can be any random color. 10 points - Each turtle can be in any random orientation. . 10 points - Each turtle can be stamped at any random coordinate within the Python turtle graphics window. 10 points - The black boundary box around the Python turtle graphics window appears correctly 10 points - The create_turtle function works correctly as specified in the comments. 10 points - The draw_boundary function works correctly as specified in the comments. 10 points - The stamp_turtle function works correctly as specified in the comments. . 10 points - A comment block appears for the write_message function in the same format as the other function comment blocks. 10 points - The code you write is high quality Note: Except for the "Program by" message, do not change anything in the main function. Also do not change any of the function names or parameters that are provided import turtle import random # # Your name # CSCI 107, Assignment 6 # Last Updated: ??, 2021 # # Use the random module to stamp randomly | # colored turtles in random locations with # random orientations. 1 # I # create_turtle # # This function has no parameters. # # Create and return a hidden turtle with # shape "turtle", speed e, pensize 10. # 1 def create_turtle(): pass # replace this statement # draw_boundary # the_turtle: the turtle to draw with #max_x: window's upper right x coordinate | # max_y: window's upper right y coordinate # Draw a rectangle around the window whose | #lower left coordinate is (-max_x; -max_y) # and whose upper right coordinate is # (max_x, max_y). def draw_boundary(the_turtle, max_x, max_y): pass replace this statement # #stamp turtle # the turtle: the turtle to draw with # max_x: window's upper right x coordinate ! #max_y: window's upper right y coordinate | # # Stamp a "turtle" at a random coordinate | # with a random color and a random # heading. def stamp_turtle(the_turtle, max_x, max_y): pass 1 replace this statement # Replace this comment with a comment appropriate for # the fully complete write_message function that follows. def write_message(the_turtle, message, message color, x, y, fontname, fontsize, fonttype): the_turtle.goto(x, y) the_turtle.color(message_color) the_turtle.write(message, font-fontname, fontsize, fonttype>> = main) + This function has no parameters. This function controls the logic for * Assignment 6. Do not make any changes to it except to modify the "Program by" + message to show your name. def main(); window - turtle. Screen() stamper = create_turtle() how many = random.randint(10, 20) upper_right_x = window.window_width) // 2 upper right y = window. window_height() // 2 draw_boundary(stamper, upper_right_x, upper_right_y) for stamp in rangehow_sany): erine art def stamp_turtle(the_turtle, max_x, max_y): pass # replace this statement # Replace this comment with a comment appropriate for # the fully complete write_message function that follows. def write_message(the turtle, message, message_color, x, y, fontname, fontsize, fonttype): the_turtle.goto(x, y) the_turtle.color(message_color) the_turtle.write(message, font-fontname, fontsize, fonttype) # # main # # This function has no parameters. # # This function controls the logic for # Assignment 6. Do not make any changes # to it except to modify the "Program by" # message to show your name. #1 def main(): window - turtle.Screen() stamper = create_turtle() how_many random.randint(10, 20) upper_right_x window.window width() 1 2 upper_right_y = window.window_height() 1/2 draw_boundary(stamper, upper right_x, upper_right_y) for stamp in range(how_many): stamp_turtle(stamper, upper_right_x, upper_right_y) message = "Turtles =" + str(how_many) write_message(stamper, message, "black", -75, -200, "Ariel", 20, "bold") message = "Program by John Paxton" write_message(stamper, message, "purple", -75, 225, "Ariel", 12, "normal") window.exitonclick() main() - 0 Python Turtle Graphics * * Turtles = 17 Program by John Paxton

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

4. Who would lead the group?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago