Write Python Function Take 2 Input Values Returns 2 Values Sorted Low High Example Functio Q37135500

Write a Python function that will take 2 input values andreturns the same 2 values that is sorted from low to high. Example:If the function name is func2, func2(5,6) retuns (5,6). func2(6,5)returns (5,6).


Solution


def func2(n1,n2): if(n1<n2): return (n1,n2) else: return (n2,n1)print(func2(5,6))print(func2(6,5))

Output:

(5, 6)
(5, 6)

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.