0
Python 'def' Function
I think I know what this is but every time I try it out, it doesn't work. (Not talking about any specific code) Can someone help define the function. (See what I did theređ)
2 Answers
+ 2
A function is a block of organized, reusable code that is used to perform a single, related action.
Example we define a function here add function that will add a + b and then print theyr sum.
def add(a,b):
print(a + b)
Now we just call that function by its name with a and b variables.
add(2,2)
š
and thats it, we just simplify the code so we dont have to write every time the seme code over and over....i hope this helps
+ 1
Thx! :)