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 HELP WITH >>>>>>>>>>>>>>>>> variable lists, IPO Chart, pseudocode, Flowchart

## All 3 Replies

The neat thing about pseudocode is it has defied hard standards. I can't guess if your class has defined it to be in some format so I'll take pseudocode to be "resembling a simplified programming language, used in program design." Since this is just resemblence and not standardized your attempt at pseudocode will do nicely. It's much like writing a book. You get better the more you do.

That's pretty low level stuff that you should be able to handle just by rereading your class notes. If you don't know how to flowchart a simple if-then structure then you've probably been sleeping in class.

What, specifically, is giving you problems?

def max(firstNumber, secondNumber):

``````if firstNumber > secondNumber:
return firstNumber
else:
return secondNumber``````

def getNumbersFromUser():

``````userFirstNumber = int(input("Please enter the first number: "))
userSecondNumber = int(input("Please entter the second number: "))
return userFirstNumber, userSecondNumber``````

def main():

``````userFirstNumber, userSecondNumber = getNumbersFromUser()
print("The maximum number between", userFirstNumber, "and", \
userSecondNumber, "is", max(userFirstNumber, userSecondNumber))``````

main()

This is my program code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.