+ 2
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?
14 Answers
+ 5
Jack Douglas ,
as Bob_Li already mentioned is your code using 1 tab instead of only spaces:
...
'=' = 61
'=' = 61
'0' = 48
':' = 58
'\n' = 10
'\t' = 9 <<<< this is a tab
' ' = 32
' ' = 32
...
it is in this line:
` return 0`
+ 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 !!
+ 3
If you're unsure about indentation in python, then read this.......
https://peps.python.org/pep-0008/
+ 3
I had corrected the indentation and it was working fine. If it still not resolved. You can email to sololearn regarding this issue along the screenshot and details at
info@sololearn.com
+ 2
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.
+ 2
Jack Douglas ,
for indentation error, the compiler gives the number of the line where the issue appears.
please check this. give us the error message.
>> do you have any comments in the code file?
+ 2
Thank you bob_li that worked!
+ 2
Thank you everybody
+ 2
Jack Douglas
I just fired off a bunch of suggestions and hoped some of them would work...š
Maybe a description of what actually worked?
It would be a helpful guide for others with similar problems.
0
Ive tried everything. Its the indentstion of this line
return (num % 2 + 10 * convert(num // 2))
Ive manually added spaces, ive tried incorrect spacing.
Nothing will pass this error.
0
Its the python developer course, the recursion practice
0
#Click on the three dots on the right of this reply, copy text and paste to the codebit editor . Maybe it's your keyboard or language setting that's adding non standard characters. Are you using the app or the web version?Does it happen to your other similar Python codes that use indentations? Lots of things to check that could give you clue on where the problem is. Or maybe a reload or update is necessary...
def convert(num):
if num==0:
return 0
return (num % 2 + 10 * convert(num // 2))
print(convert(int(input())))
0
Aysha please help me:
Code to convert the value into a number
JS
let form = document.getElementById('form'); let currency = form.elements.currency.value;
(currency);
0
Hi