Advertisement
aneliabogeva

Greater of Two Values

Jun 14th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. value_type = input()
  2. first_value = input()
  3. second_value = input()
  4.  
  5.  
  6. def compare_int(f, s):
  7. if f > s:
  8. print(f)
  9. else:
  10. print(s)
  11.  
  12.  
  13. def compare_chars(f, s):
  14. if ord(f) > ord(s):
  15. print(f)
  16. else:
  17. print(s)
  18.  
  19.  
  20. def compare_string(f, s):
  21. if f > s:
  22. print(f)
  23. else:
  24. print(s)
  25.  
  26.  
  27. if value_type == "int":
  28. compare_int(int(first_value), int(second_value))
  29. elif value_type == "char":
  30. compare_chars(first_value, second_value)
  31. elif value_type == "string":
  32. compare_string(first_value, second_value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement