0
Can someone please help me with this python assignment?
write a program that asks the user to enter an integer and prints two integers, root and pwr, such that 0 < pwr < 6 and root**pwr is equal to the integer entered by the user. If no such pair of integers exists, it should print a message to that effect.
3 ответов
0
You should really attempt to solve and show how far you got. Here is a solution
https://code.sololearn.com/cxsQ4j6G6afk/?ref=app
0
thank Jason I'll improve soon
0
(r,p)=next((r,p) for p in range(2,6) for r in [math.log(x)/log(p)] if r%1==0,(None,None))
Add tests to ensure x!=0,1 and look onky for odd p if x<0 and you have it