关于#Python#的问题,如何解决?

统计123~N之间的自然数中,所有左右对称的数之个数以及其余的数之积。N为整数,从键盘输入。

N=int(input('请输入一个整数:'))
a=[]
b=[]
for i in range(123,N):
    str1=str(i)
    x=len(str1)-1
    str2=''
    while x>=0:
        str2+=str1[x]
        x-=1
    if str2==str1:
        a.append(str1)
    else:
        b.append(int(str1))
product=1
for i in b:
    product*=i
print(len(a),product)