So I am just getting started with Python and I was practicing on Codewars. I was doing this kata, that I forgot the name of. I wrote the code going if, while and another if deep. I got this error:
else:
^
TabError: inconsistent use of tabs and spaces in indentation
I saw nothing wrong with the code and the else was aligned with the if.
# our parameters are h - the height from where the ball is falling,
# bounce - the percent of bounce out of 1.0, window - where teh mother is (1.5 m)
# HOW MANY TIMES DID THE BALL GO IN FRONT OF THE WINDOW
# Float parameter "h" in meters must be greater than 0
# Float parameter "bounce" must be greater than 0 and less than 1
# Float parameter "window" must be less than h.
def bouncingBall(h, bounce, window):
current_bounce = h
times_seen = None
if h > 0 and bounce > 0 and bounce < 1 and window < h:
while current_bounce_height > window:
current_bounce_height = current_bounce_height * bounce
if times_seen >= 1:
times_seen = times_seen + 2
else:
times_seen = times_seen + 1
print(times_seen)
return times_seen
else:
print(-1)
return -1
bouncingBall(10, 0.66, 1.5)
And the code may have other mistakes, as I said just getting started. Don't pay those any attention.