你好,我想讓我的輸入只允許整數,一旦它超過10,它顯示錯誤,任何援助將不勝感激。python輸入錯誤檢查
square_ct = input("Enter an integer from 1-5 the number of squares to draw: ")
triangle_ct = input("Enter an integer from 1-5 the number of triangles to draw: ")
while square_count(input) > 10:
print ("Error!")
square_count=input() #the statement reappears
while triangle_count(input) > 10:
print ("Error!")
triangle_count=input() #the statement reappears
解決您的壓痕。 –