Demo entry 6076748



Submitted by anonymous on Sep 25, 2016 at 03:59
Language: Python. Code size: 336 Bytes.

# define a function to exchange values of two variable
def exchange(x,y):
	z = x
	x = y
	y = z
	return (x,y)

while True:
	# ask user input the variables need to to be exchanged
	x = input("x:")
	y = input("y:")
	# create a tuple to accept the function return value
	t = exchange(x,y)
	print "x:", t[0]
	print "y:", t[1]

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).