2019-04-18
阅读量:
450
python如何使用try函数?
python如何使用try函数?
# Python code to illustrate
# working of try()
def divide(x, y):
try:
# Floor Division : Gives only Fractional Part as Answer
result = x // y
print("Yeah ! Your answer is :", result)
except ZeroDivisionError:
print("Sorry ! You are dividing by zero ")
# Look at parameters and note the working of Program
divide(3, 2)
输出 :
('Yeah ! Your answer is :', 1)






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论