Question

In: Computer Science

Write a function that draw your initials. (Using python 3 turtle) (T, S)

Write a function that draw your initials. (Using python 3 turtle) (T, S)

Solutions

Expert Solution

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

#code

import turtle

#method that draws initials T and S using turtle t
def drawInitials(t):
    #using 5 as pen size, use higher values for more thickness
   
t.pensize(5)
    #moving forward 100 spaces
   
t.forward(100)
    #moving backward 50 spaces
   
t.backward(50)
    #turning right 90 degrees
   
t.right(90)
    #moving forward 120 spaces
   
t.forward(120)
    #T is complete by now,
    #pen up
   
t.up()
    #turning left 90 degrees
   
t.left(90)
    #moving forward 150 spaces
   
t.forward(150)
    #you are at bottom left corner of S
   
t.down()
    #moving forward 50 spaces
   
t.forward(50)
    #drawing a semi circle with radius 30 to represent
    #below portion of 'S'
   
t.circle(30,180)
    #moving forward 25 spaces
   
t.forward(25)
    #turning right 180 degrees
   
t.right(180)
    # drawing a semi circle with radius 30 to represent
    # upper portion of 'S', in opposite direction
   
t.circle(30, -180)
    #moving backward 50 spaces, S is now complete
   
t.backward(50)


#creating a turtle, setting maximum speed
t=turtle.Turtle()
t.speed(0)
#pen up, moving to a starting location
t.up()
t.goto(-100,100)
#pen down
t.down()
#drawing initials
drawInitials(t)
#hiding turtle
t.ht()
#finishing drawing
turtle.done()

#output



Related Solutions

Write a function that plots the following trajectory equations using python turtle graphics. x = v*sin(A)*t...
Write a function that plots the following trajectory equations using python turtle graphics. x = v*sin(A)*t y = v*cos(A)*t -.5*(9.8)*t**2 Loop through t starting at 0 and increment by .1 until y<=0. (hint, while loop) Experiment with values of velocity V (1 to 20) and angle A (0 to 90) that gives you a good plot that does not go off the screen. Position the start of the plot at the left bottom of the screen
Write a function named cup that uses a turtle parameter t to draw a cup consisting...
Write a function named cup that uses a turtle parameter t to draw a cup consisting of three sides of a square. Your function should not change the position or orientation of t before drawing the first side of the cup. The turtle t that is passed to cup may initially be either up or down and may be at any location on the screen and in any orientation. After drawing a side, the turtle t should turn left. When...
Assignment Write a program using turtle graphics which writes your initials, or any other three unique...
Assignment Write a program using turtle graphics which writes your initials, or any other three unique letters, to the display. Look to your program for lab 1 for reminders of how to use turtle graphics. Functions that must be written: def drawLetter (x, y, letterColor): Write three functions, one for three unique letters. Personally, I would write drawA, drawR, and drawS. Each function must draw that letter to the screen. The x and y values determine the upper left-hand location...
I need to write these three functions in Python using turtle module. def line(t, coord1, coord2)...
I need to write these three functions in Python using turtle module. def line(t, coord1, coord2) t is a turtle object passed in coord1 and coord2 are 2-element lists that represent x, y coordinates draws a line from coord1 to cord2 def poly(t, *coords) t is a turtle object passed in *coords is any number of x, y coordinates each as a 2-element list draws a polygon based on coords (will close off polygon by drawing a line from last...
Python: Using available in Pages turtle technique and, if you can, more advanced tricks, draw a...
Python: Using available in Pages turtle technique and, if you can, more advanced tricks, draw a FLOWER. Submit your result as text file.
with python, create a fake logo for a company using turtle graphics
with python, create a fake logo for a company using turtle graphics
USING PYTHON 3.7 AND USING def functions. Write a function called GPA that calculates your grade...
USING PYTHON 3.7 AND USING def functions. Write a function called GPA that calculates your grade point average (GPA) on a scale of 0 to 4 where A = 4, B = 3, C = 2, D = 1, and F = 0. Your function should take as input two lists. One list contains the grades received in each course, and the second list contains the corresponding credit hours for each course. The output should be the calculated GPA. To...
Using Python 3 Write a function reads the file called simpleinterest.txt. Each row in simpleinterest.txt is...
Using Python 3 Write a function reads the file called simpleinterest.txt. Each row in simpleinterest.txt is a comma seperated list of values in the order of PV, FV, n, r. For each row, there is one value missing. Write an output file that fills in the missing value for each row.
Your (turtle) program in python must include: Create four Red turtles and four Blue turtles using...
Your (turtle) program in python must include: Create four Red turtles and four Blue turtles using one or more lists. • Start each of the Red turtles at a different random location on the left side of the screen within the range of the square formed by (-100, 100) and (0, -100) and each of the Blue turtles at a random location on the right side of the screen within the range of the square formed by (0, 100) and...
Answer 3 problems using company sql An employee signs its initials on a document ’AJ’, write...
Answer 3 problems using company sql An employee signs its initials on a document ’AJ’, write a query to find the first and last name of the employee. List the first name, last name, and salary of employees that work in the ’Hardware’ department. List the first name, last name, and salary of employees that work on ’ProductX’. Below is company.sql file DROP DATABASE IF EXISTS Company; CREATE DATABASE Company; use Company; SET foreign_key_checks = 0; DROP TABLE IF EXISTS...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT