Loop that adds user inputted numbers and breaks when user types “end”

前端 未结 4 1176
伪装坚强ぢ
伪装坚强ぢ 2021-01-27 17:23

Create a function that expects no arguments. The function asks user to enter a series of numbers greater than or equal to zero, one at a time. The user types end to indicate tha

4条回答
  •  旧时难觅i
    2021-01-27 17:40

    you could use a try catch, if there is a Value Error when you are looking for a number they probably typed end, non the less you can do the apropriate checking in the except block.

提交回复
热议问题