Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 3.5 Code Part A: 10 points A tick is a short line that is used to mark of

ID: 3666445 • Letter: P

Question

Python 3.5 Code

Part A: 10 points A tick is a short line that is used to mark off units of distance along a line. Write a function named drawTick() that uses a turtle parameter to draw a single tick of specified length perpendicular to the initial orientation of the turtle. The function drawTick() takes two parameters: 1. a turtle, t, that is used to draw 2. an integer, tickLen, that is the length of the tick When drawTick() is called, t is in the location that the first tick should be drawn. (Hint: remember that the tick mark should be drawn perpendicular to the orientation that t is in when it is called.) You should not make any assumptions about the initial up/down state of t. On return from drawTicks(), t should be in the same location and have the same orientation that it had when it was called.

Part B: 10 points Write a function named drawTicks() that calls drawTick() repeatedly to draw a set of parallel tick marks. The function drawTicks() takes four parameters: 1. a turtle, t, that is used to draw 2. an integer, tickLen, that is the length of the tick 3. an integer, numTicks, that is the number of ticks to draw 4. an integer, distance, that is the distance between parallel tick marks For example, the following would be correct output if drawTicks() were called by this code: import turtle s = turtle.Screen() turt = turtle.Turtle() drawTicks(turt, 5, 10, 15)

Question 12 (20 points) Write a function named beginsWith() that computes how many strings in a list of strings begin with a specified letter. The function beginsWith() takes two parameters: 1. letter, a string of length 1 2. strList, a list of 0 or more strings The function beginsWith() should return an integer that is the number of strings in strList that begin with letter. You may assume that no word in strList begins with a capital letter. The following is an example of correct input and output for the function beginsWith(): >>> eliza = ['the','rain','in','spain','falls','mainly','on','the','plain'] >>> firstLetter = 't' >>> print(beginsWith(firstLetter, eliza)) 2

Question 13 Write a function named greeting(). The function greeting() should ask the user for their name, and then ask the user for the day of the week. It should then greet the person by name and day and comment whether their name has fewer, more than or the same number of characters as the day. The function greeting() takes one parameter: a string named greetStr. The following is an example of correct input and output for the function greeting(): >>> greeting('Happy') What's your name? Justin What day is today? Monday Happy Monday Justin Your name has the same number of characters as today!

Explanation / Answer

Can help you with this

1)
import turtle
s = turtle.Screem()
def drawTick(t, tickLen);
t.pendown()
t.right(90)
t.forword(tickLen)
t.penup()
t.backward(tickLen)
t.left(90)
return drawTick
def drawTicks(t, tickLen, numTicks, distance);
for i in range(numTicks);
drawTick(t,tickLen)
t.penup()
t.forword(distance)
t.pendown()
return drawTicks
turtle = turtle.Turtle()
length = 5
numberofTicks=10
tickDistance=15
tick = drawTicks(turt, 5 , 10 ,15)