小编Gri*_*per的帖子

为什么我的代码跳过整个“for i in range”循环?

我遇到了一个问题,我的代码跳过for所有输入提示的循环,并直接打印循环下方的列表。

出了什么问题,我该如何解决?

import statistics

Age = list()
SaturnRT = list()
MarsRT = list()
Mars = list()
Saturn = list()
Houses = ['saturn', 'Saturn', 'Mars', 'mars']
CheckList = ['Saturn', 'saturn']
ReactionTime = list()
inputVar = None


for i in range(0, ):
    print("enter age: ")
    while inputVar != type(int):
        try:
            inputVar = int(input())
            while inputVar>16 or inputVar<12:
                print("error! invalid entry")
                inputVar = int(input("enter the age: "))
            break
        except:
            print("enter an integer! ")
    Age.append(inputVar)

    print("enter reaction time (ms): ")
    while inputVar …
Run Code Online (Sandbox Code Playgroud)

python loops range python-3.x

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

标签 统计

loops ×1

python ×1

python-3.x ×1

range ×1