ans = raw_input("Please set the starting juvenile population (or type same to leave it unchanged):")
cont, num = setGen0Check(ans, 0)
if cont == 1:
if num == 1:
juvenilePop = round(float(ans), 3)
else:
invalidInput()
y = setGen0(x, y, z)
def setGen0Check(ans, bounds):
cont = 1
cont2 = 1
num = (numOrStrCheck(46, 57, ans))
if ans.lower() != "same" and num == 0:
invalidInput()
count = 0
elif len(ans) == 0:
invalidInput()
cont = 0
elif num == 1:
if float(ans) < 0:
invalidInput()
cont = 0
if bounds == 1:
cont2 = setGen0bounds(0, 1, ans)
if bounds == 2:
cont2 = setGen0bounds(15, 25, ans)
if cont == 1 and cont2 == 1:
return 1
else:
return 0
return num
def numOrStrCheck(lowerBnd, higherBnd, ans):
for i in ans:
b = ord(i)
if b > higherBnd or b < lowerBnd:
return 0
return 1
을 반복하지 않고 개체 유형 "INT"오류를 반복 할 수 없습니다 : 라인 referance에 함께내가 오류 얻을 그것을 입력을 제공 할 때마다 정수
TypeError: 'int' object is not iterable
을 :
cont, num = setGen0Check(ans, 0)
문자열 입력을 허용하기로 결정하기 전까지는 (입력이 받아 들여진 동일한 함수에 숫자가 포함되었는지 여부를 확인해야합니다.)
도움을 주셔서 감사합니다. 앞으로이를 염두에 두겠습니다. – UncarbonatedMilk