19th Oct 2021, 4:09 AM
bernard
bernard - avatar
3 Réponses
+ 1
you have to return the value of a*b def multiply (a, b): return a * b
19th Oct 2021, 7:56 AM
ubai
ubai - avatar
0
bernard In this code you have make a function but you have not called the function and you have define parameters but you didn't give value to them. If you want set default parameters do like this: def multiply(a,b):-->making function with parameters .......print(a*b)-->giving output when function is called multiply (5,6)-->function is called Output:30 if you want o take user input then do like this: def multiply(a,b):-->making function with parameters .......print(a*b)--> for output when function is called c=int(input("Enter your 1st no"))-->taking 1st number d=int(input("Enter your 2nd no"))-->taking 2nd number multiply(c,d)--->taking variable as user input value and assigning to parameters a and b Input:5,6 Output:30 I think this will be helpful for you my friend ☺️☺️☺️ Thanks ANURAG
19th Oct 2021, 4:39 AM
Anurag Kumar
Anurag Kumar - avatar
0
You have to call the function, and determine the values of "a" and "b" in this calling Like: def func(a, b): a * b func(number_a, number_b)
19th Oct 2021, 6:16 PM
Katdotbrush
Katdotbrush - avatar