# Functions - swap two numbers
def fn_swap(x, y):
x, y = y, x
return x, y
# Main program
num1 = int(input("Enter numbre :"))
num2 = int(input("Enter numbre :"))
print("Numbers before swap :", num1, num2)
num1, num2 = fn_swap(num1, num2)
print("Numbers after swap :", num1, num2)
def fn_swap(x, y):
x, y = y, x
return x, y
# Main program
num1 = int(input("Enter numbre :"))
num2 = int(input("Enter numbre :"))
print("Numbers before swap :", num1, num2)
num1, num2 = fn_swap(num1, num2)
print("Numbers after swap :", num1, num2)
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu