Lecture 3 Control | CS 61A: Structure and Interpretation of Computer Programs Spring 2020
2020-04-21 22:12
471 查看
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
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- [公开课] CS61A打卡Spring2018(week9-week16): Structure and Interpretation of Computer Programs
- [公开课] CS61A打卡Spring2018(week1-week8): Structure and Interpretation of Computer Programs
- 读书笔记(一) -- Structure and interpretation of computer programs
- Structure and Interpretation of Computer Programs 读书笔记
- structure and interpretation of computer programs
- Structure and Interpretation of Computer Programs (the Purple Book)
- 【Structure and interpretation of Computer Programs 】学习记录兼导言
- Structure and Interpretation of Computer Programs-Exercise 1.3
- 一点SICP(Structure and Interpretation of Computer Programs) 资料 (转载加整理)
- 《structs and interpretation of computer program》讀書筆記
- 居然还有一本Structure and Interpretation of Classical Mechanics!
- 61.View the Exhibit and examine the structure of the PROMOTIONS table.
- springboot tomcat8 duplicate springSecurityFilterChain and increasing the maximum size of the cache
- Willems,J/Establishment of a reference library for evaluating computer ECG measurement programs
- svn:is not under version control and is not part of the commit, yet its child解决办法
- Bash Shell: Take Control of PS1, PS2, PS3, PS4 and PROMPT_COMMAND
- 评一篇文章(Experiments of the effectiveness of dataflow- and controlflow-based test adequacy criteria)
- 一个黑客与一个电脑白痴的经典对白——Funny talk between hack and fool of computer
- Inversion of Control and Dependency Injection with Castle Windsor Container - Part I
- Inversion of Control Containers and the Dependency Injection pattern