A = int(input()) #recom. sleep time
B = int(input()) #unrecom. sleep time
H = int(input()) #fact. slept
if (A <= H < B ):
print('Fine')
elif (A < H >= B):
print('too much')
else (A > H < B):
print('not much')
Error:
File "<ipython-input-9-12133f4a4c3d>", line 8
else(A > H < B):
^
SyntaxError: invalid syntax
伙计们不礼貌,我有经济能力并且开始学习编程:) 我无法看到通过错误检查的代码与此代码之间的区别。
答案 0 :(得分:1)
您正在使用else
进行测试。您应该使用elif
A = int(input()) #recom. sleep time
B = int(input()) #unrecom. sleep time
H = int(input()) #fact. slept
if A <= H < B :
print('Fine')
elif (A < H >= B):
print('too much')
elif A > H < B:
print('not much')