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.
hi, can you draw me a cloud using turtle from python. please send me the codes
hi, can you draw me a cloud using turtle from python. please send me the codes
In python Consider the tuple t = (2,3,4,5). Write a function tuList( t ) that takes...
In python Consider the tuple t = (2,3,4,5). Write a function tuList( t ) that takes in a tuple, makes a list out of it, and also creates a new list of all possible sums of elements of the list
with python, create a fake logo for a company using turtle graphics
with python, create a fake logo for a company using turtle graphics
Python : Write the function inAWhile that takes two integers t and d, where t is...
Python : Write the function inAWhile that takes two integers t and d, where t is the present time on a 12-hour clock, rounded to an integer (so t is an integer in the interval [1,12]) and d is an integer increment in hours, and returns the time on a 12-hour clock in d hours. For example, in 2 hours from 3 o’clock, it will be 5 o’clock, so inAWhile (3, 2) = 5. Notice that 12 is followed by...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT