To define a fuction you write the word def followed by the name you gave your fuction, in parethes you grite the values it will take, a colon ":" and in the folowing lines you write the steps the fuction will follow. at the end you write return and the value that it will end up giving.
example:
def make_sum(x,y):
ans=x+y
return ansthis program shown here uses personally made fuctions:
you can copy and paste the code from this link to try it on your own.
No hay comentarios:
Publicar un comentario