3 positive integers. Find max. I'm having trouble with the input validation coding and combining it with max code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

3 positive integers. Find max. I'm having trouble with the input validation coding and combining it with max code.

https://code.sololearn.com/chD4ZIOu1dLL/?ref=app

15th Nov 2017, 8:47 AM
Vincent
Vincent - avatar
2 Answers
+ 3
def inputValidation(a,b,c): if a > 0 and b > 0 and c > 0: return 1 else: return 0 def maximumFunction(a,b,c): maximum = a if b > maximum: maximum = b if c > maximum: maximum = c if b > c: maximum = b return maximum #def main: # Use int() to convert input to integer when # requesting user input. a,b,c = 7,12,9 if inputValidation(a,b,c)==1: print("Maximum value is",maximumFunction(a,b,c)) else: print("Invalid input!") # Hth, cmiiw
15th Nov 2017, 10:02 AM
Ipang
+ 1
Thank you very much for the assistance!
15th Nov 2017, 9:30 PM
Vincent
Vincent - avatar