n PyCharm, write a function in a module to compute the factorial of a number using a while loop.
- factorial(-1) = invalid
- factorial(0) = 1
- factorial(1) = 1*1 = 1
- factorial(2) = 2*1*1 = 2
- factorial(3) = 3*2*1*1 = 6
- factorial(4) = 4*3*2*1*1 = 24
Call your factorial function with inputs equal to 0, 1, 2, 5, and -2.
Comment your code, including module and function docstrings, and test for PEP8 compliance.
Click on the print icon in your PyCharm console and save the output as console.pdf
Submit your .py files and console.pdf in Canvas.
Rubric (100 points):
- (20 points) The correct files are submitted. Files have meaningful names. Each block of code is in the correct file.
- (20 points) Each Python file provides thorough comments, including module and function docstrings. Code and comments are PEP8-compliant.
- (20 points) Only structures covered so far are used. Functions, parameters, and types are used properly. Unnecessary structures, global variables, hard-coded values, break, and continue are not used. Code is clean and lean.
- (20 points) The printout shows that the code returns the correct values and messages for the valid test values and the correct error messages for the invalid test values.
- (20 points) The function calls are located in a different file than the module file and cover all cases listed in the instructions. We encourage students to create additional tests, but will not grade them.
Get Help With a similar task to - python hw
Tutlance Experts offer help in a wide range of topics. Here are some of our top services:
- Math homework help
- Nursing homework help
- Statistics homework help
- Nursing coursework help
- Capstone project writing services
- Essay writers for hire
- Case study writing help
- Buy college papers online
- Buy college research papers
- College homework help
- Professional resume writing services
- Programming homework help
- Coursework writing help
- Term paper writing help
- Biology homework help
- Do my physics homework
- Dissertation data analysis help
- PhD Dissertation writing services
- Chemistry homework help
Post your project now for free and watch professional experts outbid each other in just a few minutes.