官术网_书友最值得收藏!

  • Python Essentials
  • Steven F. Lott
  • 227字
  • 2021-07-16 13:53:13

Summary

We've looked at how we assign objects to variables. We've looked at the simple assignment statement, as well as multiple assignment and augmented assignment. With augmented assignment, we can update a variable by applying an operator and an operand. This is a handy syntactic shortcut.

We've also addressed the input() function, which is a way to create new objects based on user input. It's very handy for simple command-line scripts. More sophisticated GUIs, of course, will have considerably more sophisticated input mechanisms.

The concept of a namespace, and how variables are tracked via a namespace, is central to Python. When a namespace is no longer needed, it's discarded, removing all of the variables. This will also reduce the reference count on all of the objects referred to by the variables. Once an object's reference count is reduced to zero, the object can be removed from memory. This is a tidy and simple way to handle variables.

In Chapter 5, Logic, Comparisons, and Conditions, we'll look at another fundamental data type: Boolean. We'll look at Python's approach to Boolean values and the logical operators of and, or, not, and if-else. We'll also look at the various comparison operators.

We'll look at several kinds of Python statements, include the if-elif-else statement, the pass statement, and the assert statement. This will allow us to write somewhat more sophisticated scripts.

主站蜘蛛池模板: 百色市| 山阴县| 江孜县| 绥阳县| 木里| 夏河县| 宁夏| 扬州市| 延川县| 金川县| 枣阳市| 福建省| 比如县| 双鸭山市| 伊吾县| 扎兰屯市| 灵石县| 蒙阴县| 大同市| 东海县| 九寨沟县| 普陀区| 北安市| 德安县| 广东省| 长顺县| 广南县| 弥渡县| 宁强县| 普洱| 扶绥县| 祁东县| 随州市| 荣昌县| 壤塘县| 郴州市| 华容县| 醴陵市| 太湖县| 晋中市| 阿勒泰市|