Question

Python 3.5 Code Part A: 10 points A tick is a short line that is used...

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!

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Python 3.5 Code Part A: 10 points A tick is a short line that is used...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • MUST BE IN PYTHON!!!! PLEASE HELP WITH NUMBER 10 & 11A & 11B!!! WIILL VOTE UP!!!...

    MUST BE IN PYTHON!!!! PLEASE HELP WITH NUMBER 10 & 11A & 11B!!! WIILL VOTE UP!!! F=False boolExprs = [T and F, T or F, T and T, F or F trueCount = 0 for expr in boolExprs: if expr: trueCount += 1 print (trueCount) a. 1 b. 2 c. 3 d. 4 e. None of the above Question 10 import tu1rtle s turtle.Screen () t turtle. Turtle () for i in range 4) if i%2 = 1: t.down )...

  • Answer must be in Python 3 Answer: import turtle def trifecta(size,angle,num): for i in range(num): tri(t,size)...

    Answer must be in Python 3 Answer: import turtle def trifecta(size,angle,num): for i in range(num): tri(t,size) t.right(angle) t = turtle.Turtle() s = turtle.Screen() trifecta(100,25,5) Question 11 Part b (10 points) Write a function named trifecta() that takes three parameters: 1. size 2. angle 3. num trifecta() should call tri() repeatedly so as to draw num triangles, each with sides of length size. Each triangle should be oriented angle degrees clockwise from the preceding triangle. trifecta() should create a turtle and...

  • Python 3 code Write a function named coinflip that accepts an input called flips. The function...

    Python 3 code Write a function named coinflip that accepts an input called flips. The function should sim-ulate flipping a coin flips times. The function should return True if the coin was the same result for every flip. You can assume the function receives a positive integer as input. Write a second function named simulation that runs trials of the coin flip experiment. simulation should accept two parameters: the number of trials, and the number of coin flips to do...

  • write C code that uses pointers, arrays, and C strings. 3. Write a function called pow_xy....

    write C code that uses pointers, arrays, and C strings. 3. Write a function called pow_xy. The function should be passed 2 parameters, as illustrated in the prototype below. int pow_xy(int *xptr, int y); Assuming that xptr contains the address of variable x, pow_xy should compute x to the y power, and store the result as the new value of x. The function should also return the result. Do not use the built-in C function pow. For the remaining problems,...

  • Python 3.6 Question 12 (20 points) Write a function named wordLengths. The function wordLengths takes two...

    Python 3.6 Question 12 (20 points) Write a function named wordLengths. The function wordLengths takes two parameters: 1. inFile, a string that is the name of an input file 2. outFile, a string that is the name of an output file The input file exists when wordLengths is called; wordLengths must create the file outFile. The input file contains only letters and white space For each line of the input file, wordLengths should identify the length of the longest word...

  • project-8c Write a class named Employee that has data members for an employee's name, ID_number, salary,...

    project-8c Write a class named Employee that has data members for an employee's name, ID_number, salary, and email_address (you must use those names - don't make them private). Write a function named make_employee_dict that takes as parameters a list of names, a list of ID numbers, a list of salaries and a list of email addresses (which are all the same length). The function should take the first value of each list and use them to create an Employee object....

  • Python 3.6 Question 12 (2θ points) write a function named uniqueWords that counts how many different...

    Python 3.6 Question 12 (2θ points) write a function named uniqueWords that counts how many different words there are in each line of an input file and writes that count to a corresponding line of an output file. The input file already exists when uniqueWords is called. uniquewords creates the output file. Input. The function uniquewords takes two parameters: ◆ inFile, a string that is the name of text file that is to be read. The file that inFile refers...

  • Using python Question 13 (20 points) Write a function named Linestats that finds the number of...

    Using python Question 13 (20 points) Write a function named Linestats that finds the number of consonant and vowel letters on each line of a file and writes those statistics to a corresponding line of a new file, separated by a space. Definitions: A vowel letter is one of a, e, i, o, u, along with the corresponding uppercase letters..A consonant letter is not a vowel letter. The function linestats takes two parameters: 1. inFile, a string, the name of...

  • Python 3.6 I JUST NEED HELP WITH PROBLEM 2 (CONTINUATION OF PROBLEM 1)!!! THIS IS MY...

    Python 3.6 I JUST NEED HELP WITH PROBLEM 2 (CONTINUATION OF PROBLEM 1)!!! THIS IS MY WORK FOR PROBLEM 1 (I NEED HELP WITH PROBLEM 2): Python 3.6 Problem 1 This problem provides practice using a while Irue loop Write a function named twoWords that gets and returns two words from a user. The first word is of a specified length, and the second word begins with a specified letter. The function twoWords takes two parameters: 1. an integer, length,...

  • Write a function named mostFrequent that takes two parameters: 1. inFile, a string that is the...

    Write a function named mostFrequent that takes two parameters: 1. inFile, a string that is the name of an input file 2. outFile, a string that is the name of an output file The input file inFile exists when mostFrequent is called; mostFrequent must create outFile. The input file contains only lower case letters and white space. The function mostFrequent identifies the letter(s) that appear most frequently on each line of inFile and writes them to a corresponding line of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT