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

What is the algorithm for this problem written in psuedocode that can be transla

ID: 3669961 • Letter: W

Question

What is the algorithm for this problem written in psuedocode that can be translated into python? must use function and return values

Maximum of two Values

Design a function named max that accepts two integer values as arguments and returns the value that is 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.

Explanation / Answer

The question is not clear. Do you need algorithm or python code. Algorithm can be general for any programing language and code can be language specific. I will be showing here some pseudocode and then python code

Algorithm

function getMax(val1 , val2)

if value1 is greater than value2 then return value1
else return value2

end

python code

#function to calculate maximum value

def function_max(value1, value2):

if value1 > value2:

return value1

else:

return value2

#end of function

# Readtwo integer values

value1 = input("Enter first integer value: ")

value2 = input("Enter second integer value: ")

# call the function

max_value = function_max(value1, value2)

print "Max value = ", max_value

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote