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.

3rd Aug 2018, 2:15 AM
darell
darell - avatar
3 Answers
0
You should really attempt to solve and show how far you got. Here is a solution https://code.sololearn.com/cxsQ4j6G6afk/?ref=app
3rd Aug 2018, 5:11 AM
JME
0
thank Jason I'll improve soon
3rd Aug 2018, 10:19 AM
darell
darell - avatar
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
10th Aug 2018, 6:20 AM
VcC
VcC - avatar