Recursively implement the function halves that takes two positive integers a and b, and returns a list containing the value a (converted to type float) and all successive halves of a that are greater than b. I tried like this but it's returning an empty list and I don't understand what's going on:
def metades(a, b):
if a < b: return []
if a > b:
lst = []
a = float(a/2)
lst.append(a)
return lst and metades(a,b)
print(metades(100,3))
Should return:
[100.0, 50.0, 25.0, 12.5, 6.25, 3.125]
Return:
[]