像计算机科学家一样思考Python

最新书摘:
  • [已注销]
    2015-09-03
    input: Get data from the keyboard, a file, or some other device.output: Display data on the screen or send data to a file or other device.math: Perform basic mathematical operations like addition and multiplication.conditional execution: Check for certain conditions and execute the appropriate code.repetition: Perform some action repeatedly, usually with some variation.
  • sssssen
    2012-11-10
    write pure function wherever it is reasonable and resort to modifier only if there is a compelling advantage---functional programming style
  • sssssen
    2012-11-09
    for [instances], the default behavior of the == operator ist the same as the is operator; it checks [object identity], not [object equivalence].
  • sssssen
    2012-11-04
    A [hash] is a function that takes a value (of any kind) and return a integer. Dictionaries use these intergers, called [hash values] to store and look up key-value pairs.
  • sssssen
    2012-11-04
    It is important to distinguish between operations that [modify] lists and operations that [creat] new lists.
  • 某个用户
    2016-04-18
    This is an example of a program development method called problem recognition,which means that you recognize the problem you are working on as an instance of a previously-solved problem,and apply a previously-developed solution
  • 某个用户
    2016-04-18
    If you were really thinking like a computer scientist, you would have recognized that uses_all was an instance of a previously-solved problem,and you would have written:
  • 某个用户
    2016-04-17
    The final version of the function doesn`t display anything when it runs;it only returns a value.The print statements we wrote are useful for debugging,but once you get the function working,you should remove them.Code like that is called scaffolding because it is helpful for building the program but is not part of the final product.When you start out,you should add only a line or two of code at a time.As you gain more experience,you might find yourself writing and debugging bigger chunks.Either way,incremental development can save you a lot of debugging time.The key aspects of the process are:1.Start with a working program and make small incremental changes.At any porint,if there is an error,you should have a good idea where it is.2.Use temporary variables to hold intermediate values ...