Question: Given a positive integer number ( < = 3 1 8 = 3 8 7 4 2 0 4 8 9 ) , write a

Given a positive integer number (<=318=387420489), write a Python function named is_power_of_three to return whether the number is an integer power of 3 or not. Try doing this using a single line of code without using a loop or math module.
For example, your call, is_power_of_three(81) must return True because 34=81.
Test your function in your main program for the numbers 27,177147 and 4782976.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!