Guest User

Untitled

a guest
Dec 11th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. def compare(x,y):
  2.     if x > y:
  3.         return 1
  4.     elif x == y:
  5.         return 0
  6.     else:
  7.         return -1
  8.  
  9. prompt_x = "enter nuber x: "
  10. prompt_y = "enter number y: "
  11.  
  12. x = input(prompt_x)
  13. y = input(prompt_y)
  14.  
  15. if compare(x,y) == 1:
  16.     print x,"is greater tnan",y
  17. else:
  18.     if compare(x,y) == 0:
  19.         print x,"and",y,"are equal"
  20.     else:
  21.         print x,"is less than",y
Add Comment
Please, Sign In to add comment