帮忙看看这个怎么改,新人不太会用python~

2019-05-25 21:25发布

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32

Type "copyright", "credits" or "license()" for more information.

>>> x=9

>>> while x>2:

x=x-2

print(x)

if x==1:

i=range(1,6)

j=range(1,i+1)

else:

i=range(5)

j=range(4)

 

7

5

3

1

Traceback (most recent call last):

  File "<pyshell#2>", line 6, in <module>

    j=range(1,i+1)

TypeError: unsupported operand type(s) for +: 'range' and 'int'

>>> i

range(1, 6)

>>> j

range(0, 4)

>>> 


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。