IDLE中的解释器问题

时间:2017-09-20 02:57:48

标签: python python-3.x

以为我会在这里询问所有地方。我写了一个不会运行的脚本。

    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语句的正确位置。怎么回事?

1 个答案:

答案 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 )