I'm trying to find a number that's Python symmetrical

Asked 2 years ago, Updated 2 years ago, 14 views

list1 = []

for i in range(1,1001):
    str1 = str(i)
    for j in range(0,len(str1)):
        if str1[j] == str1[-1-j]:
            list1.append(i)


print(list1)

Like 12321, we try to find the same number in the middle Since it's salty like that, if the front and the back match, it's included in the list 1 How do I make them all match so they're added to the list?

python palindrome

2022-09-20 20:18

1 Answers

For example, the 7 digit can be verified to be true: If you get one wrong, it's not the number of calls.

Therefore:

If you meet the requirements of , what you want will be realized. Try it!


2022-09-20 20:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.