Function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Function

When we are writing a function. We have to define the variables and arguments at the same time? Purpose for the arguments? I am writing a simple program to multiply three numbers from user and returns the product.

2nd Feb 2022, 3:31 PM
Knowledge Is Power
Knowledge Is Power - avatar
2 Answers
+ 3
How about this funtion. This funtion has no parameters and it doesn’t accept any arugument. def multiply(): a= int(input()) b = int(input()) c = int(input()) return a*b*c multiply() Arguments are just values. Paramater is important. You must use the same paramater name , indside the funtion. To access the value it recieved when calling the funtion. def multiply(a,b,c): return a*b*c multiply(1,2,3)
2nd Feb 2022, 3:51 PM
hamishhr
hamishhr - avatar
+ 2
Thank you so much!! Building patience to learn coding..beginner. Appreciate your support👍
2nd Feb 2022, 4:12 PM
Knowledge Is Power
Knowledge Is Power - avatar