Question

Number Comparison: Write a program in PYTHON that compares three numbers and displays the following: Check...

Number Comparison:

Write a program in PYTHON that compares three numbers and displays the following:

  1. Check if they are all the same, all different, or neither.
  2. Determine if 3 numbers are in increasing order, decreasing order, or neither.
  3. Find the highest and lowest number.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

"""
  Python program - Number comperator
  Check if they are all the same, all different, or neither.
  Determine if 3 numbers are in increasing order, decreasing order, or neither.
  Find the highest and lowest number.
"""

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))

def isSame(num1, num2, num3):
  
  if (num1 == num2) and (num1 == num3):
    print("All are Same")
  elif (num1 != num2) and (num1 != num3) and (num2 != num3):
    print("All are different")
  else:
    print("Neither same nor different")

def getOrder(num1, num2, num3):

  if (num1 < num2) and (num2 < num3):
    print("Increasing Order")
  elif (num1 > num2) and (num2 > num3):
    print("Decreasing Order")
  else:
    print("Neither in increasing order nor in decreasing")

def getHighestLowest(num1, num2, num3):

  if (num1 > num2) and (num1 > num3):
    highest = num1
  elif (num2 > num1) and (num2 > num3):
    highest = num2
  else:
    highest = num3
  
  if (num1 < num2) and (num1 < num3):
    lowest = num1
  elif (num2 < num1) and (num2 < num3):
    lowest = num2
  else:
    lowest = num3
  
  print("Highest: ", highest)
  print("Lowest: ", lowest)

print('')

isSame(num1, num2, num3)
getOrder(num1, num2, num3)
getHighestLowest(num1, num2, num3)

# Program ends here

Add a comment
Know the answer?
Add Answer to:
Number Comparison: Write a program in PYTHON that compares three numbers and displays the following: Check...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT