A function can be used in various styles in python. following are the examples of various function styles-
- void Function (Non Fruitful Function)
def power(): x=intinput((“Enter Base”)) y=intinput((“Enter Exponent”)) for i in range(y): r=r*x print(r)
- Function with Arguments (Non Fruitful Function)
def power(x,y): for i in range(y): r=r*x print(r) a=intinput((“Enter Base”)) b=intinput((“Enter Exponent”)) power(a,b)
- Function with return type (Fruitful Function)
def power(x,y=3): for i in range(y): r=r*x return r a=intinput((“Enter Base”)) b=intinput((“Enter Exponent”)) total = power(a,b) print(total)