def is_Power_of_three(n):  
    while (n % 3 == 0):  
         n /= 3;           
    return n == 1;  
  
print(is_Power_of_three(9))  
print(is_Power_of_three(81))  
print(is_Power_of_three(21))

 

相关文章:

  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-11-17
  • 2021-10-25
  • 2021-06-13
  • 2021-09-13
猜你喜欢
  • 2021-07-17
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
相关资源
相似解决方案