Link Search Menu Expand Document

Python Review

For this assignment you will implement and test seven functions.

Your functions will be implemented in the file my_functions.py and code to test the functions will be written in main.py. I have already implemented one function in my_functions.py and main.py contains code to test this function.

my_functions.py contains function headers and docstrings for the seven functions that you are to write. Read the docstrings to see what the functions are supposed to do. There is more info on docstrings below.

You may need to search online to figure out how to implement some of the functions. If you are new to Python or want a more complete overview of the basics of Python, see the official Python tutorial: https://docs.python.org/3.9/tutorial/index.html

Submission

Accept the assignment from GitHub Classroom https://classroom.github.com/a/ai40yv6G

Commit your changes to the 2 Python files and push your code to GitHub. Tests will be run on your code on each push. Follow all naming conventions used!

  • Variables are underscore = my_variable
  • Functions are camelCase = myFunction()

If the tests all pass you should see something like this:

============================= test session starts ==============================
platform linux -- Python 3.8.1, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /tmp/tmpi4gb32a1/tests, inifile:
plugins: timeout-1.2.0
collected 5 items

tests.py .....

=========================== 8 passed in 0.02 seconds ===========================

If there are any failures you will see additional information about each failure.

The pep8 utility will also be run on your code to ensure that it conforms to the PEP 8 style guide. For full credit your code must pass all the tests and adhere to PEP 8. Each PEP 8 warning will tell you the filename, line number, and reason for the voliation in the messages. Below is an example where the line of code was too long in the my_functions.py file on line 76.

/home/tester/1645629545_go_c8kah/cs232-python-review/my_functions.py:76:80: E501 line too long (80 > 79 characters)

Grade: 25 points

  • 1 point - work submitted
  • 7 points - functions implemented
  • 5 points - test cases written in main.py
  • 7 points - functions pass all tests (main.py and automated tests)
  • 5 points - Submission does not have any PEP 8 violations and follows the established naming conventions