此代码显示运行时错误为NZEC。通过input()和raw_input两种方法都尝试了,仍然显示错误。
# A = int(input('Enter the amount of A: '))
# B = int(input('Enter the amount of B: '))
A, B = raw_input().split(" ")
A = int(A)
B = int(B)
if (A > 0 and B > 0):
print('The mixture is a solution: ')
elif (A == 0):
print('The mixture is Liquid: ')
elif (B == 0):
print('The mixture is Solid: ')
else:
print('Invalid Entry')
在Python 3中没有raw_input
,因为所有输入都是raw_input。假设代码工作正常且不抛出错误:
A = int(input('Enter the amount of A: '))
B = int(input('Enter the amount of B: '))
if (A > 0 and B > 0):
print('The mixture is a solution: ')
elif (A == 0):
print('The mixture is Liquid: ')
elif (B == 0):
print('The mixture is Solid: ')
else:
print('Invalid Entry')