Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Maximum of Two Values Design a function named max that accepts two integer value

ID: 3853580 • Letter: M

Question

Maximum of Two Values

Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two.

need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code

2.) Test Average and Grade

Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program:

calcAverage—This function should accept five test scores as arguments and return the average of the scores.

determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale:

F

need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code

Score Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D Below 60

F

need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code

Explanation / Answer

MAximum of two numbers :

def max( firstNumber , secondNumber ): //function max crated with two argument
if firstNumber > secondNumber:
return firstNumber
else:
return secondNumber

def getNumbersFromUser(): //getNumbersFromUser created for taking input from user
userFirstNumber = int( input( "Please enter 1 numbr" ) )
userSecondNumber = int( input( "Please enter 2 numbr" ) )
return userFirstNumber, userSecondNumber
  
def main():
userFirstNumber, userSecondNumber = getNumbersFromUser()
print( " Maximum : ", max(userFirstNumber, userSecondNumber ) )

main()
  

2. average

def calcAverage( s1, s2, s3, s4, s5 ):

average = ( s1 + s2 + s3 + s4 + s5 ) / 5

return average

def determingrade( userscore ):

if( userscore < 60 ):

return "F"

elif( userscore < 70 ):

return "D"

elif( userscore < 80 ):

return "C"

elif( userscore < 90 ):

return "B"

elif( userscore < 101 ):

return "A"

def askscore():

s1 = float( input( "Enter s1 " ) )

s2 = float( input( "Enter s2 " ) )

s3 = float( input( "Enter s3 " ) )

s4 = float( input( "Enter s4 " ) )

s5 = float( input( "Enter s5 " ) )

return s1, s2, s3, s4, s5

def printresult( s1, s2, s3, s4, s5 ):

print( " score Grade" )

print( str( s1 ) + " " + determingrade( s1 ), str( s2 ) + " " + determingrade( s2 ), str( s3 ) + " " + determingrade( s3 ),str( s4 ) + " " + determingrade( s4 ),str( s5 ) + " " + determingrade( s5 ) )

def main():

s1, s2, s3, s4, s5 = askscore()

printresult( s1, s2, s3, s4, s5 )

main()