See Guided Practice 4.2 – Creating and Calling a library of functions Task 1 – Make a pseudocode

  

See

Guided Practice 4.2 – Creating and Calling a library of functions

Don't use plagiarized sources. Get Your Custom Essay on
See Guided Practice 4.2 – Creating and Calling a library of functions Task 1 – Make a pseudocode
Just from $10/Page
Order Essay


Task 1 – Make a pseudocode – Creating and Calling library functions

In this guided practice we are going to create a number of functions we will add to a library in our PythonFiles directory. We will then use the import statement to pull all of the functions into a separate program. In this way you will gather together your functions which you can then use in any Python programs going forward.

We will now create the pseudocode for the program

Create the pseudocode for a program that will

·
Create a file of functions and place them into a functions.py file

·
Make a new program called CallFunctions and import the functions.py file

·
Call each of the functions in the functions file

Deliverables for Task 1

·
Pseudocode for functions file


Task 2 – Write and test the function to import functions

First, create the functions.py library and put it into your PythonFiles folder. The functions file can include any of the programs from previous weeks but they all need to be defined as functions.

Now create a new file named CallFunctions in your IDLE. Enter the following information:

import Functions

print(“<Your studentID>”)

Functions.HelloWorld()

Functions.CheckEven()

Functions.Birthday()

Run the program and verify it is working properly.

Add the functions from your Guided practices for 2.3 (NumberSort.py), 3.2 (ReadNames.py) and 3.3 (ReadWebPage.py and PullPDF.py) to the function file.

Run the new functions from the CallFunctions.py program. Take a screenshot of the program and the output.


Deliverables for Task 2

· Screenshot of the your code and the output of your program.


Task 3 – Simple Turtle graphics in a function

Now we are going to take some of the items we have done in previous labs and put them into their own functions. This will allow us to call the graphics functions multiple times with only a single command.

Let’s put in the function for a square, program the following:

import turtle

def square(size):

for i in range(4):

turtle.forward(size)

turtle.right(90)

Test your function by putting at the bottom:

square(100)

Run the program to verify that your square function is working properly. Take a screenshot.

Let’s add two more shape functions called circle and rectangle:

def circle(size):

turtle.circle(size)

def rectangle(sideA,sideB):

for i in range(2):

turtle.forward(sideA)

turtle.right(90)

turtle.forward(sideB)

turtle.right(90)

Verify these work by adding the following lines to the end of the program and take a screenshot.

square(100)

turtle.penup()

turtle.forward(150)

turtle.pendown()

circle(50)

turtle.penup()

turtle.forward(50)

turtle.pendown()

rectangle(100,50)

Finally we’re going to add a function that will draw any shape on the turtle screen.

Add the following to your program

def anyshape(sides, direction):

angle = int(360/sides)

size = int(900/sides)

for I in range(sides):

turtle.forward(size)

if direction == ‘r’:

turtle.right(angle)

else:

turtle.left(angle)

You can also test the function by typing

anyshape(5, ‘r’)

Try using the number 7. Why doesn’t it work?

anyshape(7, ‘r’)

Test your function with a different number of sides and take a screenshot of your results.


Deliverables for Task 3

Screenshot of your square

Screenshot of your square, circle, and rectangle

Answer question about anyshape with 7 sides.

Screenshot of your anyshape function

image3.png

image4.png

image5.png

image1.png

image2.png

Guided Practice Lab Report

Before completing this guided practice report, you should have completed the associated procedure.

Screenshots

As you complete the procedure for the guided practice, add your screenshots below.

Guided Practice Questions

After you have completed the procedure for the guided practice, provide your answers to the guided practice questions here.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 30% with the discount code ESSAYSHELP