+ 2
Hi there.. who can tell me about functions & models in the part 3 I don't understand
I mean I don't understand what to do in functions & models in the question lvl 3 I don't understand it
4 odpowiedzi
+ 5
Functions are used so that you can reuse them. For example, if you needed to keep checking how much stock was in your shop, it would be easier to write a function then keep on writing the code. In python, functions are written like:
def func():
your_code
Inside the brackets, you can add what we call arguments, which the function uses to help it run. For example in the shop again, you might need to 'tell' the function how much stock you have bought, how much you need, ect. This is how you give arguments:
def stock(bought, sold):
your_code
stock(10, 5) #this runs it
Hope this helps!
+ 2
Which language?
+ 1
+ 1
In sayhallo have parameter. The parameter is david. When it call sayhallo. So the function is output hi. Dahid(name)