$30
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
• If there are built-in functions in Python that can accomplish the require task DO NOT
USE THEM. Write code that uses loops and/or decisions to meet the requirements of the
functions.
Required functions
def square (intValue):
This function returns the square of intValue.
def isOdd (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.
def sumOfOdds (intValue):
This function returns the summation of 1 to intValue of the odd values in the range. You can
assume that intValue will be positive. For example, sumOfOdds(5) would return 9 (1 + 3 + 5).
def sumOfSquares (intValue):
This function returns 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 compareTo (intValue1, intValue2):
This functions returns -1 if intValue1 is less than intValue2, returns 1 if intValue1 is greater
than intValue2, or returns 0 if intValue1 is equal to intValue2.Part 2
Assignment
Write another program using SimpleGraphics which writes your initials, or any other three
unique letters, to the display. You should be able to use most of the code from program 5b.
Functions that must be written
def drawLetter (x, y, letterColor):
Write three functions, one for three unique letters. Personally, I would write drawT, drawL, and
drawS. Each function must draw that letter to the screen. The x and y values determine the
upper left-hand location for the start of the letter, just as you did in the previous program. It will
probably work out best if you ensure that each letter takes the same amount of space, both
vertically and horizontally. The letterColor parameter will be a string used to determine the
color of the letter – use it to set the color of the letter.
As in the previous assignment, the code for drawing each letter should not write to an absolute
location, but to locations based upon the x, y coordinates passed to the function as arguments.
def drawShadowedLetter (x, y, letterColor, offset):
Write three more functions, one for each letter (mine would be drawShadowedT,
drawShadowedL, and drawShadowedS). These functions will use your drawLetter functions,
once using letterColor for the color argument, and once adding offset to the x and y values
and using “black” for the color argument. This will create a “shadowed” letter, drawing a
colored letter over a black letter. These three functions will not be doing any actual drawing, all
of the graphics work will be done in the drawLetter functions.
In the main program, draw your initials to the screen twice. The first time write your initials to the
screen using the drawLetter functions. Somewhere else on the display, write your initials to
the screen using the drawShadowedLetter functions.
Requirements
Complete comment section that includes your name, id number, program number and a brief
description of the prog