miércoles, 8 de abril de 2015

#mastery12 MASTERY 12

CREATING PYTHON FUNTIONS
Mastery # 12 

Funtions are very helpful, when you are programming, this can simplify your code, and make it easy to re-use the same procedimient or funtion.
here's a example about how to create python funtions.
def funtion(b,c): # this is the funtion, begins with def name(parameters)

    if  (b>c):
        print(b/c)
    elif (b<c):
        print(c/b)
#here finish the funtion
b=int(input(print(" give me a number")))
c=int(input(print("give me another number")))
ans=funtion(b,c) # here the funtion is called and asigned to a variable
print(ans) # and here's were the funtion show us the results

No hay comentarios:

Publicar un comentario