If else command giving different answer

First, you should check out the About the Users category post for how to format code in your posts.

Regarding your example:
input() returns a string (str) object, not a numeric type, so you’re comparing strings, not numbers. You could convert the input to numbers right away:

x = int(input())
y = int(input())

Or you could convert them later: if int(x) > int(y)