functions in python

PreparationDownload and run the program PracticeFunctions.py. Download PracticeFunctions.py.Look at what it does and look at the code to get an idea of the program structure.
DirectionsThe programming assignment for this unit has two functions. Use these two functions as models for the functions you are to write. You will be removing code from main() and putting it in several separate functions. The behavior of the program will not change throughout the exercise, so you can always tell if your program is correct. As you copy code from the main to a function, you will have to change the name of variables to match the names of the function parameters.
Use the non-fruitful function drawRect as a model. Write another non-fruitful function that draws a filled circle. The function is defined as
def drawFilledCircle(t, rad):
“”” Draws a filled circle of radius rad using turtle t “””and called with a statement likedrawFilledCircle(alex, radius)The contents of the function are to begin filling, draw a circle, end filling.Make sure you call your function in two different places in the program, using a different parameter each time.
Write another non-fruitful function drawEquilateralTriangle , which is defined asdef drawEquilateralTriangle(t, side):
“”” Draws an equilateral triangle using turtle t with sides of length side “””
and is called withdrawEquilateralTriangle(alex, tri_side)Make sure to use the parameters side in the body of this function. Make sure you call your function in two different places in the program, using a different parameter each time.
Next, you’ll work with fruitful functions. Look at the function to calculate the next y-position for drawing a set of shapes. This function is called near the bottom of the program:ypos = next_y_position(ypos, width)Using this function as a model, add a fruitful function to calculate the length of a side of an equilateral triangle with a given area, which is math.sqrt(length*width*4/math.sqrt(3)). The function is defined withdef getSide(len,wid):
“”” Returns the length of a triangle side with an area of len * wid “”” and it is called with the statementtri_side = getSide(length,width)Make sure you use the parameters len and wid in the body of the function.
Again, using this function as a model, add a fruitful function to calculate the value math.sqrt(length*width/math.pi)which appears near the end of the program. The function should be defined asdef getRad(len,wid): “”” Returns the radius of a circle with an area of len * wid “”” and it is called with the statementradius = getRad(length,width)Make sure you use the parameters len and wid in the body of the function.
Make sure your functions have the same parameters and the same comment as in the assignment description. Write a complete header comment.
Create your own function and call it from main. Your function doesn’t have to do a lot, but it does have to do something.
SubmissionSubmit the file with .py extension.
Write a reflection in the comment box answering the following questions:
Describe the new function you added. Give its name.
In a sentence or two, what did you learn?
In a sentence or two, what did you like about this project?
In a sentence or two, what did you find confusing or would like to see done differently regarding this project?
In a sentence or two, if you had another hour or two, what would you like to add to the project or how would you do things differently?

Don't use plagiarized sources. Get Your Custom Essay on
functions in python
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Choose Us

Top quality papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional academic writers

We have hired a team of professional writers experienced in academic and business writing. Most of them are native speakers and PhD holders able to take care of any assignment you need help with.

Free revisions

If you feel that we missed something, send the order for a free revision. You will have 10 days to send the order for revision after you receive the final paper. You can either do it on your own after signing in to your personal account or by contacting our support.

On-time delivery

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & confidential

We use several checkers to make sure that all papers you receive are plagiarism-free. Our editors carefully go through all in-text citations. We also promise full confidentiality in all our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

You are welcome to choose your academic level and the type of your paper. Our academic experts will gladly help you with essays, case studies, research papers and other assignments.

Admissions

Admission help & business writing

You can be positive that we will be here 24/7 to help you get accepted to the Master’s program at the TOP-universities or help you get a well-paid position.

Reviews

Editing your paper

Our academic writers and editors will help you submit a well-structured and organized paper just on time. We will ensure that your final paper is of the highest quality and absolutely free of mistakes.

Reviews

Revising your paper

Our academic writers and editors will help you with unlimited number of revisions in case you need any customization of your academic papers