摘要:
4.6. Defining FunctionsWe can create a function that writes the Fibonacci series to an arbitrary boundary:我们创建一个斐波那契数列的函数:>>> def fib(n): # write F... 阅读全文
摘要:
4.1. if StatementsPerhaps the most well-known statement type is the if statement. For example:if语句可能是最常见的控制流语句了,例如:>>> x = int(input("Please enter an ... 阅读全文
摘要:
3.1.3. ListsPython knows a number of compound data types, used to group together other values. The most versatile is the list, which can be written as... 阅读全文
摘要:
3.1. Using Python as a CalculatorLet’s try some simple Python commands. Start the interpreter and wait for the primary prompt, >>>. (It shouldn’t take... 阅读全文