小编Soc*_*nme的帖子

Why is the integer not recognized to be more than 0?

Here's something taken out of my code to check if the value is greater than 0 and if it's a number:

while(1):
        n = input("Type a number of rolls to do, to try and get 3 of the same sides in a row.")
        if n.isdigit() and int(n) > 0 == True:
            n = int(n)
            break
        else:
            print("Select a proper integer.")
Run Code Online (Sandbox Code Playgroud)

For some reason if you enter a value that should stop the loop like 10, it's seen as a wrong …

python python-3.x

0
推荐指数
1
解决办法
55
查看次数

标签 统计

python ×1

python-3.x ×1