0

I'm practicing Python so I decided to recreate the max() function for 2 numbers. The code doesn't have an error, it just doesn't return anything. Please help! `

def newMax(num1, num2):
    if num1 > num2:
        return num1
    elif num2 > num1:
        return num2
    elif num1 == num2:
        return "They're both equal!"
    else:
        return "We've run into some sort of error. Make sure you entered 2 numbers."
print("This program will return the largest of 2 numbers you enter.")
number1 = input("Please enter your first number.")
number2 = input("Please enter your second number.")
newMax(number1, number2)

`

Can you not call a function with variables as the parameters, and if not then how would I write this program? FIGURED OUT, I had a print statement error, sorry.

Natan Garanto
  • 31
  • 1
  • 6

1 Answers1

1
new_max = newMax(number1, number2)
print(new_max)

Try assigning it to a variable and printing that variable.

nulltron
  • 637
  • 1
  • 9
  • 25