美文网首页
Python 28 Programming Tutorial -

Python 28 Programming Tutorial -

作者: 豆表示低调 | 来源:发表于2016-08-31 11:40 被阅读0次
# exceptions are not syntax errors, they are problems that occur while your programs running


# tuna = int(input("Whats your fav number?\n"))
# print(tuna)


while True:
    try:
        number = int(input("Whats your fav number?\n"))
        print(18/number)
        break
    except ValueError:
        print("Durrr, try again hoss.")
    except ZeroDivisionError:
        print("Don't pick zero")
    except:
        # not usually good because it can hide problems
        break
    finally:
        print('loop complete')

相关文章

网友评论

      本文标题:Python 28 Programming Tutorial -

      本文链接:https://www.haomeiwen.com/subject/zhaxettx.html