admin管理员组文章数量:1609899
Print and None
None Indicates that Nothing is Returned,The special value None represents nothing in Python
A function that does not explicitly return a value will return None
Careful: None is not displayed by the interpreter as the value of an expression
Pure Functions & Non-Pure Functions
Nested Expressions with Print
Life Cycle of a User-Defined Function
Names Have Different Meanings in Different Environments
Statement
While Statements
Operators
it comes to division, Python provides two infix operators: / and //. The former is normal division, so that it results in a floating point, or decimal value, even if the divisor evenly divides the dividend:
>>> 5 / 4
1.25
>>> 8 / 4
2.0
The // operator, on the other hand, rounds the result down to an integer:
>>> 5 // 4
1
>>> -5 // 4
-2
These two operators are shorthand for the truediv and floordiv functions.
>>> from operator import truediv, floordiv
>>> truediv(5, 4)
1.25
>>> floordiv(5, 4)
1
本文标签: StructureCSLecturecontrolSpring
版权声明:本文标题:Lecture 3 Control | CS 61A: Structure and Interpretation of Computer Programs Spring 2020 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1728576181a1164498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论