小编Om *_*ash的帖子

TypeError:range()整数结束参数expect,得到str在Python中

我是新手,正在尝试使用python.我在python中编写了一个程序,当我执行时,我得到了错误.谁能帮帮我吗?

程序:

first = raw_input("Enter the first no:")
second = raw_input("Enter Second no:")
if first <= 0:
        print "Enter a valid number"
if second <= first:
        print "Sencond number should be greater than first"
for x in range(first,second):
        for i in range(2, i):
                if x % i == 0:
                        j = x/i
                        print x,  " is not a prime no"
                        print "%d = %d*%d" % (x, i, j)
                        break;
                else:
                        print x, " is not a prime number"
Run Code Online (Sandbox Code Playgroud)

输入和错误:

Enter …
Run Code Online (Sandbox Code Playgroud)

python range

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×1

range ×1