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 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.
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...
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...
Write a Python program that uses function(s) for writing to and reading from a file: a....
Write a Python program that uses function(s) for writing to and reading from a file: a. Random Number File Writer Function Write a function that writes a series of random numbers to a file called "random.txt". Each random number should be in the range of 1 through 500. The function should take an argument that tells it how many random numbers to write to the file. b. Random Number File Reader Function Write another function that reads the random numbers...
USE PYTHON-LIST Q1 - You need to keep track of book titles. Write code using function(s)...
USE PYTHON-LIST Q1 - You need to keep track of book titles. Write code using function(s) that will allow the user to do the following. 1. Add book titles to the list. 2. Delete book titles anywhere in the list by value. 3. Delete a book by position. Note: if you wish to display the booklist as a vertical number booklist , that is ok (that is also a hint) 4. Insert book titles anywhere in the list. 5. Clear...
The coding for this program to run as described on Python: Your (turtle) program must include:...
The coding for this program to run as described on Python: Your (turtle) program must include: include import turtle on a line after the comments so you can use the various Turtle-related objects and methods. Create a turtle named after your favorite ice cream flavor. Make sure the name has no punctuation and consists only of letters, numbers and the underscore character. Write your python program so your turtle is constantly moving and can be turned left and right using...
(Python) a) Using the the code below write a function that takes the list xs as...
(Python) a) Using the the code below write a function that takes the list xs as input, divides it into nss = ns/nrs chunks (where nrs is an integer input parameter), computes the mean and standard deviation s (square root of the variance) of the numbers in each chunk and saves them in two lists of length nss and return these upon finishing. Hint: list slicing capabilities can be useful in implementing this function. from random import random as rnd...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT