0

Bug in Sololearn app??

So Iā€™m trying to get past a python level, and Iā€™m solving it but it says indentation error no matter what I do.. even did the stuck -> see solution and did exactly what it has for the solution. Here is the code def convert(num): if num ==0: return 0 return (num % 2 + 10 * convert(num // 2)) a=int(input()) print(convert(a)) It might have screwed up the indentation on this post but Iā€™ve been stuck on it for about a month now. Can anyone help?

29th Sep 2024, 5:37 AM
Jack Douglas
Jack Douglas - avatar
3 Answers
+ 3
The problem you are facing this indentation because you are using unequal spaces between each indentation. All indentation should have equal number of spaces. I hope this helps. Happy coding !!
29th Sep 2024, 6:11 AM
Aysha
Aysha - avatar
+ 2
If you're unsure about indentation in python, then read this....... https://peps.python.org/pep-0008/
29th Sep 2024, 12:27 PM
Jan
Jan - avatar
+ 1
are you mixing tabs and spaces? or maybe typing the solution in some other ide and copy-pasting it here? What I usually do is to delete the indentations and re-indent them manually using the spacebar.
29th Sep 2024, 5:53 AM
Bob_Li
Bob_Li - avatar