def is_geometric(li):
if len(li) <= :
return True
# Calculate ratio
ratio = li[]/float(li[])
# Check the ratio of the remaining
for i in range(, len(li)):
if li[i]/float(li[i-]) != ratio:
return False
return True print(is_geometric([, , , ])) print(is_geometric([, , 2.5, 1.25])) print(is_geometric([, , , ]))