Answer:
def powersOf3ToN(n):
try:
num = int(round(n))
except (ValueError, NameError, TypeError):
print("Parameter of the function must be integer or float")
quit()
num_list = range(num)
val_list = [pow(3,x) for x in num_list if pow(3,x) in num_list]
print(val_list)
powersOf3ToN(30)
Explanation:
The python code prints out a list of integer numbers that are equivalent to the power of three. The function accepts integer and floating numbers but not strings or it prints an error message and quits the program.