Write a function to swap 2 values. The function takes exactly 2 arguments and returns nothing. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Write a function to swap 2 values. The function takes exactly 2 arguments and returns nothing.

make sure it works with any type of input arguments

10th Mar 2017, 12:42 AM
charumathi.n
charumathi.n - avatar
3 ответов
0
def swap(a,b): a,b=b,a print a,b OR def swap (a,b): a=a+b b=a-b a=a-b a=input ("enter num") b= input ("enter num") swap(a,b)
10th Mar 2017, 7:30 AM
Ria Mathur
Ria Mathur - avatar
0
I want to take user input and swap with functions please..
10th Mar 2017, 1:02 PM
charumathi.n
charumathi.n - avatar
0
u can simply take input and cal the function
10th Mar 2017, 1:46 PM
Ria Mathur
Ria Mathur - avatar