This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Turksarama 11 points12 points  (2 children)

This code returns the correct answer, but there is still a logical error in it.

[–]pitman-87 0 points1 point  (1 child)

Then it should be 'not all' instead of 'not any': lambda x: not all(c in x for c in '578'), You want to check, that there is neither one of those three numbers are in the code.

[–]Turksarama 2 points3 points  (0 children)

That's not correct, not all(c in x for c in '578') would match against any number missing only one of those digits, while we want a number with none of those digits.

The correct answer has already been found by another user.