1.输出斐波那契数列前20个
a = 0
b = 1
for _ in range(20):
a, b = b, a + b
print(a, end=' ')
2.判断一个数是否是回文数
num = int(input('请输入一个正整数: '))
temp = num
num2 = 0
while temp > 0:
num2 *= 10
num2 += temp % 10
temp //= 10
if num == num2:
print('%d是回文数' % num)
else:
print('%d不是回文数' % num)