-1
first_num, second_num = input("Enter the first number: "), input("Enter the second number: ")

if first_num > second_num :
    print(first_num, ' is the greatest number.')

else :
    print(second_num, ' is the greatest number.')
hivert
  • 10,396
  • 3
  • 29
  • 55
  • Does this answer your question? [How do I parse a string to a float or int?](https://stackoverflow.com/questions/379906/how-do-i-parse-a-string-to-a-float-or-int) – Brian Feb 20 '21 at 16:18
  • @Epsi95 There are no such things as `string`, `numeric`, or casting in Python. Comments like that just confuse beginners. – Brian Feb 20 '21 at 16:21

1 Answers1

0

You are comparing two strings, not integer or float. you must convert input to int or any other format you want then compare them. So the complete code should be:

first_num, second_num = int(input("Enter the first number: ")), 
int(input("Enter the second number: "))

if first_num > second_num :
    print(first_num, ' is the greatest number.')

else :
    print(second_num, ' is the greatest number.')
hivert
  • 10,396
  • 3
  • 29
  • 55
Milad Yousefi
  • 146
  • 1
  • 9