What will be the output after the following code is executed and the user enters 75 and -5 at the first two prompts? try: tot_cost = float(input('Enter total cost of items: ')) num_items = int(input('Enter number of items: ')) avg_cost = tot_cost / num_items except ZeroDivisionError: print('ERROR: Number of items cannot be zero!') except ValueError: print('ERROR: Number of items cannot be negative!') else: print('There were no run-time errors!') finally: print('We are finally done with this!')单项选择题
A
We are finally done with this!
B
There were no-run time errors!
C
There were no-run time errors! We are finally done with this!
D
Number of items cannot be negative! We are finally done with this!
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
Pick the code/s that correctly implements the following: Get a user input and save as 'min' variable if this input is not an integer, go to step 1 print it out to the console and exit the loop
Which keyword handles a thrown exception?
Which keyword explicitly throws an exception?
Error handler codes, to handle unusual errors are:
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!