Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 反转一系列数字的输出_Python 3.x_Range - Fatal编程技术网

Python 3.x 反转一系列数字的输出

Python 3.x 反转一系列数字的输出,python-3.x,range,Python 3.x,Range,我已经为输出写下了代码 for n in range(10): print(str(n) * n) 1 22 333 4444 55555 666666 7777777 88888888 999999999 ,但我不知道如何获得输出 for n in range(10): print(str(n) * n) 1 22 333 4444 55555 666666 7777777 88888888 999999999 会产生 for n in range(9,

我已经为输出写下了代码

 for n in range(10):
       print(str(n) * n)
1
22
333
4444
55555
666666
7777777
88888888
999999999
,但我不知道如何获得输出

 for n in range(10):
       print(str(n) * n)
1
22
333
4444
55555
666666
7777777
88888888
999999999
会产生

for n in range(9,0,-1):
       print(str(n) * n)
范围的最后一个参数为负表示我们需要递减