Unremovable Collatz Conjecture indentation error

My solution runs for all test cases on my IDE but runs on Exercism editor until I cancel it when it gives "indent error on line 2. I use a while loop but that’s not the problem. Out of ideas! Help!

Can you provide your code?

It sounds like you’re introducing invalid indentation when copying from your IDE to the website.

I restarted Exercism and fopied the program in by hand. Same problem same error message

def steps(number):
if number < 1:
raise ValueError(“only positive integers are allowed”)
if type(number) != int:
raise TypeError(“only positive integers are allowed”)
count = 0
while number != 1:
if number%2 == 0:
number = int(number/2)
else:
number = int(3 * number + 1)
count += 1

return count

def steps(number):
if number < 1:
raise ValueError(“only positive integers are allowed”)
if type(number) != int:
raise TypeError(“only positive integers are allowed”)
count = 0
while number != 1:
if number%2 == 0:
number = int(number/2)
else:
number = int(3 * number + 1)
count += 1
return count

sorry…
i lose the indents when I copy and paste here. But they are correct in the actual program

That’s a problem if we’re trying to troubleshoot an indentation error. Try using a code block and pasting your code into there. Type ``` to open the block, hit enter, paste your code in, hit enter, and type those three backticks again to complete the code block.

The code as sent to my (text only, not html) seems to have been preserved, and is presented as this:

def steps(number):
    if number < 1:
        raise ValueError("only positive integers are allowed")
    if type(number) != int:
        raise TypeError("only positive integers are allowed")
    count = 0
    while number != 1:
        if number%2 == 0:
            number = int(number/2)
        else:
            number = int(3 * number + 1)
        count += 1

    return count

Hopefully that helps to clarify intention, even though the platform itself does not (necessarily) present what was intended.


```python
# Your code here
```

Note: This might be the wrong code, as there seems to be two messages that present similar but different code.

If that’s the code being run, the indents seem fine. I guess what may be happening is Exercism is showing you the results from a previous run. Was line 2 originally not indented correctly? Perhaps you fixed that, reran the tests, but canceled the run before there was anything new to report.

After many hours of frustration I found the test required ‘Only…’ wheras I had ‘only…’
Sorry to have bothered y’all