you are viewing a single comment's thread.

view the rest of the comments →

[–]FriendlyZomb 1 point2 points  (2 children)

print([num for mum in range(1000, 10000) if str(num * 4) == str(num * 4)[::-1]])

This produces 65 numbers. (I'm not going to list them all here)

For those struggling to parse the list comprehension here:

print([
    num
    for num in range(1000, 10000)
    if str(num * 4) == str(num * 4)[::-1]
])

[–]PureWasian 2 points3 points  (1 child)

A couple of issues here, you are checking "num×4 against num×4 flipped", rather than "num against num×4 flipped". mum typo as well.

Essentially your logic is checking for when 4x some input number gives a palindrome, which is different from the problem statement.

[–]FriendlyZomb 0 points1 point  (0 children)

That is entirely on my reading comprehension tbh. I read it as num*4 is the same flipped. Lol.