Last time we checked the type and said if it is a float you're okay. If not, carry on.
并且会告之是否是一个浮点数,如果不是继续循环。
When you think about an int or a float or a dictionary or a list, you knew that there were functions that operated on them.
当你想到整型,浮点型,或者链表时,你知道可以用函数去处理他们,但是当你传递一个参数,例如链表。
- And then I divide by an int -- that's okay because so long as you have a float involved at some point early on, you're okay.
然后我除以一个整型数-,那是可以的因为现在为止,我们在之前已经,引入了一个浮点数,你是对的。
I can't rely on the user. I want to make sure I get a float in it, so how do I do that?
我想确保这儿我得到的是一个浮点数,我该怎么做呢?
I can't rely on Professor Guttag if I give this- if this code to him, I can't rely on him to type in a float. Actually I can, because he's a smart guy, but in general, I can't rely on the user-- I wouldn't do it right to see if you did.
当Guttag使用这段代码的时候-,我不能相信他一定会输入一个浮点数,实际上我能因为他很聪明,但是总体上来讲,别相信用户一定会按照规则来-,我会故意做错来试试你的程序的。
应用推荐