Solve problem "Negative exponent" online - Learn Python 3 - Snakify

Problem «Negative exponent» (Easy)


Statement

Given a positive real number \( a \) and integer \( n \).

Compute \( a^{n} \). Write a function power(a, n) to calculate the results using the function and print the result of the expression.

Don't use the same function from the standard library.


In all the problems input the data using input() and print the result using print().



Saved solutions

Tests

Input Correct answer Result
2
-3
0.125
2
1
2
2
2
4
2
3
8
2
4
16
2
9
512
2
10
1024
2
15
32768
2
0
1
3
1
3
3
2
9
3
3
27
3
10
59049
3
0
1
1.1414
2
1.30279
1.5
10
57.665
1
-1
1
2
-1
0.5
2
-2
0.25
2
-3
0.125
2
-4
0.0625
2
-8
0.00390625
2
-9
0.00195312
2
-10
0.000976562
2
-15
3.05176e-05
3
-1
0.333333
3
-2
0.111111
3
-3
0.037037
3
-4
0.0123457
3
-5
0.00411523
3
-10
1.69351e-05
3
-6
0.00137174
1.1414
-2
0.767581
1.5
-10
0.0173415