Question

Part One: Write a program to draw a picture by defining functions and using Turtle Graphics....

Part One: Write a program to draw a picture by defining functions and using Turtle Graphics. Use the following guidelines to write your program.

  1. Give your artwork a name. Print the name to the output
  2. Draw a picture using the turtle. You can pick the subject of your picture. Some suggestions include a house, a car, a face, a robot.
  3. At least two programmer-defined functions must be used.
  4. Use at least one color apart from black.
  5. The picture should include color.

Insert your pseudocode here:

Part Two: Code the program. Use the following guidelines to code your program..

  1. To code the program, use the Python IDLE.
  2. Using comments, type a heading that includes your name, today’s date, and a short description of the program.
  3. Follow the Python style conventions regarding indentation and the use of white space to improve readability.
  4. Use meaningful variable names.

Homework Answers

Answer #1

1)

CODE

import turtle

def print_name():

t = turtle.Turtle()

t.penup()

t.setposition(0, 0)

t.pendown()

t.fillcolor("blue")

t.write("Sample programming")

def draw_hexagon():

polygon = turtle.Turtle()

polygon.penup()

polygon.setposition(150, 150)

polygon.pendown()

polygon.color("blue")

num_sides = 6

side_length = 70

angle = 360.0 / num_sides

for i in range(num_sides):

polygon.forward(side_length)

polygon.right(angle)

turtle.done()

def draw_star():

star = turtle.Turtle()

star.penup()

star.setposition(200, 200)

star.pendown()

star.color("green")

for i in range(5):

star.forward(50)

star.right(144)

turtle.done()

print_name()

draw_hexagon()

draw_star()

2)

CODE

# Name: Your name

# Today's date: 13th September, 2019

# Python code to sum the element of an array

lst = [1, 2, 3, 4, 5]

sum = 0

for i in lst:

sum += i

print (sum)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
############################### ##8. Write an if statement that uses the turtle graphics library to determine ##whether the...
############################### ##8. Write an if statement that uses the turtle graphics library to determine ##whether the turtle’s heading is in the range of 40 degrees to 50 degrees ##including 40 and 50 in the range). If so, raise the turtle’s pen. ##Solution: ##angle = float(input('Enter the angle from 40 to 50: ')) ##import turtle ##turtle.left(angle) ##turtle.forward(distance) ##if turtle.heading() >= 40 and turtle.heading() <= 50: ## turtle.penup() ## print('Turtle pen is up') ###8.1 A little extension of 8: Write an if...
Using Python, write a turtle program that asks the user for a numerical value Sand draws...
Using Python, write a turtle program that asks the user for a numerical value Sand draws six triangles forming a windmill. The length of the other two sides are given by the expressions S x sin (π / 6) and S x cos (π / 6). The internal angles of each triangle are 30, 60 and 90 degrees. It will not let me include the example.
Write a Python graphics program that draws the following shapes: •    window size: 250 x 250...
Write a Python graphics program that draws the following shapes: •    window size: 250 x 250 pixels with window title with your name •    big circle, 50 pixels radius with center at (125, 125) •    two green circles, 10 pixels radius; first one centered at (113, 113) and second centered at (137, 113) •    one red line, from (100, 150) to (150, 150) Then answer this, what do you see? (make this a comment in your code)
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using the following guidelines - Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Take the array and its size as input params and return a bool. Print out a message "Entering <function_name>" as the first statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out...
Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python...
Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python program using the Python IDE based on recursion with trees that is both depth first and breadth first searches. The Python program to be developed will demonstrate the use of both depth-first (DFS) and breadth-first (BFS) searches. A tree node structure will be developed that will be used both for DFS and BFS searches. The program will apply recursion both for the DFS and...
3. For this problem, you should describe the algorithm using a flowchart and then write Python...
3. For this problem, you should describe the algorithm using a flowchart and then write Python code to implement the algorithm. You will write the Python code in a Python program file and then run it to obtain the output. Include in your HW document a photo of your flowchart and a screenshot of your code and the output in IDLE you get when you run the program. Algorithm: Ask the user to enter the user’s first name, the number...
Write a C++ Program Consider the following incomplete C++ program: #include <iostream> using namespace std; int...
Write a C++ Program Consider the following incomplete C++ program: #include <iostream> using namespace std; int main() {    …. } Rewrite the program include the following statements. Include the header file fstream, string, and iomanip in this program. Declare inFile to be an ifstream variable and outFile to be an ofstream variable. The program will read data from the file inData.txt and write output to the file outData.txt. Include statements to open both of these files, associate inFile with...
Problem: A company wants a program that will calculate the weekly paycheck for an employee based...
Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company, an employee earns $20 an hour for the first 40 hours that they work. The employee earns overtime, $30 an hour, for each hour they work above 40 hours. Example: If an employee works 60 hours in a week, they would earn $20/hr for the first 40 hours. Then they would earn $30/hr for the...
Python code only! (Do not include breaks or continue functions) Write a program that asks the...
Python code only! (Do not include breaks or continue functions) Write a program that asks the user to enter the amount that they budgeted for the month. A loop should then prompt the user to enter their expenses, one at a time and to enter 0 to quit. When the loop finishes, the program should display the the amount of budget left. (a negative number indicates the user is over budget and a positive number indicates the user is under...
Using your programming language python, write a program that will ask for: - Probability of A...
Using your programming language python, write a program that will ask for: - Probability of A - Probability of B - Probability of B given A and will then output the probability of A given B using Bayes Theorem. You can prompt for the input anyway you like (command line, GUI, website, etc), and return the result any way you like (command line, GUI, website, etc). You may not use any libraries that implement Bayes for you - you need...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT