-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,579
  • 3
  • 31
  • 56
  • 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) – Brian61354270 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. – Brian61354270 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,579
  • 3
  • 31
  • 56
Milad Yousefi
  • 191
  • 2
  • 9