Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This will be done using Python. Write each of the following functions using Python. The function header MUST be written as specified. In your
This will be done using Python. Write each of the following functions using Python. The function header MUST be written as specified. In your main code test all of the specified functions. Each function must have a comment block explaining what it does, what the parameters are and what the return value is. Please remember the following two guidelines: unless the purpose of the function is to generate output DO NOT write to the screen within the function (output for debugging purposes does not apply) unless the purpose of the function is to ask the user for a value DO NOT ask the user for a value within the function Required functions def square (intValue): This function returns the square of intValue. def summation (intValue): This function returns the summation of 1 to intValue. You can assume that intValue will be positive. For example, summation (5) would return 15 (1+ 2+ 3+ 4+ 5). def sumOfSquare (intValue): This function return the sum of the squares from 1 to intValue. For example, sumOfSquares (5) would return 55 (1 + 4+9+16+ 25). You MUST use a loop and the square function to determine the returned value. def factorial (intValue): This function returns the factorial of 1 to intValue. You can assume that intValue will be positive. For example, factorial (5) would return 120 (1 *2*3*4*5). def distance (x1, y1, x2, y2): This function returns the distance between two points. x1, y1 will be the first point, and x2, y2 will be the second point. The formula is distance = (x2 x1)+(y y1). You will want to look at the functions offered by the Math class to help with this formula. def isOdd (int intValue): This function will return True if intValue is odd, otherwise it returns False. def isEven (intValue): This function will return True if intValue is even, otherwise it return False. This function MUST use isOdd to determine the returned value. The point behind this function is to minimize the amount of redundant work that is done in our code, not that determining odd or even is a lot of work. It's the concept more than the reality of the code in this case.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started