以为我会在这里询问所有地方。我写了一个不会运行的脚本。
def quiz_decimal(low, high):
float(low)
float(high)
num = float(input('Type a number between', low, 'and', high, end=':\n')
if num < low:
print('No,', num ,'is less than', low)
elif num > high:
print('No,', num, 'is greather than', high)
elif num > low and num < high
print('Good!', low, '<', num, '<', high )
3.6.2 IDLE环境说第5行的冒号有问题,但这似乎在if语句的正确位置。怎么回事?
答案 0 :(得分:0)
您在第4行缺少一个括号.num = float(input ...))
def quiz_decimal(low, high):
float(low)
float(high)
num = float(input('Type a number between', low, 'and', high, end=':\n'))
if num < low:
print('No,', num ,'is less than', low)
elif num > high:
print('No,', num, 'is greather than', high)
elif num > low and num < high
print('Good!', low, '<', num, '<', high )