Python scripting
Performance Assessment 4.4 – Create Library of functions
Task 1 – Pseudocode
Now you are going to create pseudocode for three functions GoodbyeWorld, CheckOdd, and DaysTillGrad along with the main program. These functions should work together to read, write and append a line onto a file.
Let’s start with the pseudocode
Function GoodbyeWorld
· Printout Goodbye world (opposite of Hello World)
End.
Function CheckOdd
· Check to see if the number is odd (opposite of Check Even)
End.
Function DaysTillGrad
· Based on Birthday but using graduation date instead of birthday (subtract grad date from todays date)
End.
Program Main
· Call all three new functions
End.
Deliverables for Task 1
· Pseudocode to functions and main program to import and use them.
Task 2 – Writing the program importing functions
First, create the PAfunctions.py library and put it into your PythonFiles folder. The functions file the three functions GoodbyeWorld, CheckOdd, and DaysTillGrad.
Now create a new file named CallFunctions_PA41 in your IDLE. Don’t forget to include a print statement at the top of the program which prints out your student ID.
Create a function named readwebpage which opens the url https://quotes.toscrape.com/page/2/ parses the data using a second function and the outputs the quotes and authors using a 3rd function.
Take a screenshot of your completed program and another of your output.
Deliverables for Task 2
· Screenshot of your completed program and the output
Task 3 – Add functions for ReadWeb and ReadPDF
Add the two functions for ReadWeb and ReadPDF to your Functions.py program. Set ReadWeb to pull information from https://quotes.toscrape.com/page/3/ and your ReadPDF to pull date from SimplePDF.pdf.
Call the functions from your CallFunctions.py program and take a screenshot of the code and the results.
Deliverables for Task 3
· Screenshot of your completed program and the output