SICP_Chapter1 Building Abstractions with Functions
1.2 Elements of Programming 1.2.6 The Non-Pure Print Function >>> print(print(1), print(2)) 1 2 None None 注意 print(1)和 print(2)的返回值是 None。 1.4 Designning Functions 1.4.1 Documentation docstring。在函数名后在``````中描述函数信息。第一行用来描述函数,接着空一行,接着可以描述参数等。 help(pressure)可以查看函数帮助信息。 >>> def pressure(v, t, n): """Compute the pressure in pascals of an ideal gas. Applies the ideal gas law: http://en.wikipedia.org/wiki/Ideal_gas_law v -- volume of gas, in cubic meters t -- absolute temperature in degrees kelvin n -- particles of gas """ k = 1....