There's a lot of errors with this approach. To begin with, it's not a regex :P But if you read the actual error, its cause is the fact your're trying to compare a string (ele) with an integer, which has incorrect value too. Also, your loop will return after checking just the first octet, which isn't what you want.
This comment is hidden because it contains spoiler information about the solution
Have you tried printing list?
You're not validating the input.
I was facing the same trouble, but later i've checked that instead of making the function return a integer (as it's supposed to), I was printing it. For us the same result is being shared, but you have to return it, instead of print it
No, your code is not correct. Print the input, see with which ones your code fails.
Read the last point, but also read all that document.
Can you show the code which did not work for you?
In fact, after forfiting and veiwing the solution - my code is the same!!
Something really wrong with the test/submit function here
I feel like there's something wrong with the test here - my code returns the correct value but fails the test.
Maybe my code is wrong, but it's frustrating to see it 'work' then fail the test.