Python power函数

power函数

from math import pow

def power(x, y):
    if y == 0:
        return 1
    tot = 1
    for i in range(y):
        tot *= x
    return tot
    
if __name__ == '__main__':
    for x in range(5):
        for y in range(5):
            print('Pow(x, y):	', x, y, int(pow(x, y)))
            print('Power(x, y):	', x, y, power(x, y))
Resistance is Futile!
原文地址:https://www.cnblogs.com/noonjuan/p/11108662.html