def quotient(a, b):
if b == 1:
return a
else:
if a > b:
a = a - b
p = p + 1
else:
return p
return quotient(a, b)
If you do this, the indentationError: unindent does not match any outer indentation level I get this error How shall I do it?
python indentation
def quotient(a, b):
if b == 1:
return a
else:
if a > b:
a = a - b
p = p + 1
else:
return p
return quotient(a, b)
Python separates blocks by indentation. If ~ else must be indented in front of the same size.
I think it would be better to have a habit of indent with tabs or indent with 2 spaces (or 4 spaces) at a time you indent with tabs.
© 2024 OneMinuteCode. All rights reserved.