str='0123456789'
x=str[::-2]
print(x)

python可以用切片的方法进行倒序输出,非常的方便快捷