1
저는 파이썬을 배우는 데 새로운 경험이 있으며 수학 함수로 놀고있었습니다. 나는 당신이 특정 힘을 찾을 수있게 해주는 함수를 만들려고했다. 사각형, 큐브. 아래 코드를 실행하면 필요한 권한을 대부분 나열하지만 일부는 놓칠 수 있습니다.파이썬 수학 함수가 주어진 범위 내의 모든 해답을 찾지 못했습니다
def more_powers():
print "For which power do you wish to find: "
power = int(raw_input("> "))
print "Choose the upperbound: "
n = int(raw_input("> "))
for num in range(2, n):
for base in range(2, num):
if log(num, base)/power == 1:
print "%d is a power of %d." % (num, base)
else:
base += 1
For which power do you wish to find:
> 3
Choose the upperbound:
> 5000
8 is a power of 2.
27 is a power of 3.
64 is a power of 4.
343 is a power of 7.
512 is a power of 8.
729 is a power of 9.
1331 is a power of 11.
1728 is a power of 12.
2197 is a power of 13.
2744 is a power of 14.
3375 is a power of 15.
4096 is a power of 16.
는 5, 6, 10, 17