Python Forum
Returning the highest value out of 3 values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returning the highest value out of 3 values
#1
I'm trying to create a program that will allow the user to input 3 values and have the program state the highest value.
The error:

line 7, in <module>
    if num1>(num2,num3):
TypeError: '>' not supported between instances of 'int' and 'tuple'

print("This is a program that will return your largest value")

num1 = int(input("Please enter your first number: "))
num2 = int(input("Please enter your second number: "))
num3 = int(input("Please enter your third number: "))

if num1>(num2,num3):
    print("Your largest value is:", num1)

if num2 > (num1,num3):
    print("Your largest value is: ", num2)

else:
    print("Your largest value is: ", num3)
Reply


Messages In This Thread
Returning the highest value out of 3 values - by ComputerSkillet - Apr-27-2017, 08:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Methods that return the highest score from the list erfanakbari1 7 7,174 Mar-26-2019, 08:32 PM
Last Post: aankrose
  how to get the highest monthly average temperature? nikhilkumar 2 7,051 Jul-25-2017, 02:33 PM
Last Post: DeaD_EyE
  Numerically determining the highest a ball travels when shot straight up JakeWitten 3 3,437 Apr-22-2017, 04:37 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020