[Functions >> functions and if statements] Write the definition of a function powerTo which receives two parameters, a double and an integer.

[Functions >> functions and if statements] Write the definition of a function powerTo which receives two parameters, a double and an integer.

LANGUAGE:  PYTHON

CHALLENGE:

[Functions >> functions and if statements] Write the definition of a function powerTo which receives two parameters, a double and an integer.
If the second parameter is positive, the function returns the value of the first parameter raised to the power of the second.
Otherwise, the function returns 0.

SOLUTION:


def powerTo (double,int):
if int>=0:
    return double**int
else:
    return 0

Add comment