I've come across an issue where my code is skipping the for
loop with all the input prompts and is going straight to the printing of the lists below the loop.
What is wrong and how can I fix this?
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 != type(float):
try:
inputVar = float(input())
while inputVar < 0 or inputVar > 500:
print("enter a valid time! ")
inputVar = float(input())
House = str(input("enter the house: "))
while House not in Houses:
print("error! invalid entry")
House = str(input("enter the house: "))
if House in CheckList:
SaturnRT.append(inputVar)
Saturn.append(House)
else:
MarsRT.append(inputVar)
Mars.append(House)
break
except:
print("enter an valid time! ")
ReactionTime.append(inputVar)
print(SaturnRT)
print(MarsRT)
print("saturn reaction times avg: ", statistics.mean(SaturnRT))
print("saturn fastest time: ", min(SaturnRT))
print("saturn slowest time: ", max(SaturnRT))
print("mars reaction times avg: ", statistics.mean(MarsRT))
print("mars fastest time: ", min(MarsRT))
print("mars slowest time: ", max(MarsRT))
print(ReactionTime)
print(Age)