0

What are arguments

It's a silly question but i really need an answer

7th Oct 2021, 8:08 PM
Hayam Mohammed
Hayam Mohammed - avatar
4 Respostas
+ 4
A Python function argument is a value you pass by assignment to a function parameter under a function call. The parameter become a local variable inside the function: def f(x): return x ** 2 # Here x is a parameter in the function head. res = f(10) # Here the value 10 becomes the argument to the function, and is assigned to the parameter x (like x = 10). Now the passed argument can be used inside the functions body, so x ** 2 will become 10 ** 2. Sometime even the parameter above is called argument.
7th Oct 2021, 8:13 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Hayam Mohammed , The explanation given by Per Bratthammar applies to other languages as well
7th Oct 2021, 8:32 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
0
Ok, you've said "python function argument" Is it (the argument) in python differ from the other languages? Per Bratthammar
7th Oct 2021, 8:16 PM
Hayam Mohammed
Hayam Mohammed - avatar
0
Per Bratthammar Oh got it Thanks alot
7th Oct 2021, 8:58 PM
Hayam Mohammed
Hayam Mohammed - avatar