单选题:执行以下代码并输入75和0之后,输出结果是什么?
执行以下代码并输入75和0之后,输出结果是什么?
def main():
try:
total = int(input("Enter total cost of items? "))
num_items = int(input("Number of items "))
average = total / num_items
except ZeroDivisionError:
print('ERROR: cannot have 0 items')
except ValueError:
print('ERROR: number of items cannot be negative')
main()
@[A](2)
A. ERROR: cannot have 0 items
B. ERROR: number of items can't be negative
C. 0
D. 无显示内容。无print语句显示average变量
A.ERROR: cannot have 0 items
B.ERROR: number of items can't be negative
C.0
D.无显示内容。无print语句显示average变量
答案:A
def main():
try:
total = int(input("Enter total cost of items? "))
num_items = int(input("Number of items "))
average = total / num_items
except ZeroDivisionError:
print('ERROR: cannot have 0 items')
except ValueError:
print('ERROR: number of items cannot be negative')
main()
@[A](2)
A. ERROR: cannot have 0 items
B. ERROR: number of items can't be negative
C. 0
D. 无显示内容。无print语句显示average变量
A.ERROR: cannot have 0 items
B.ERROR: number of items can't be negative
C.0
D.无显示内容。无print语句显示average变量
答案:A