One more problem in Create a FUNCTION. How to create a function,pass parameter and return value? Please tell me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

One more problem in Create a FUNCTION. How to create a function,pass parameter and return value? Please tell me

I am learning PYTHON programming language and I just stuck in FUNCTION.

23rd Jun 2019, 9:13 AM
MADHUBAN
MADHUBAN - avatar
1 Answer
+ 2
def my_function_name (parameter1, parameter2): print("You passed", parameter1, "as the first parameter, and", parameter2, "as the second parameter.") return parameter1 + parameter2 x = my_function_name(2,5) # x is assigned the value given in the function's return line. print(x) #prints 7
23rd Jun 2019, 9:37 AM
Russ
Russ - avatar