Python Learning: 02
Posted 奎恩东特
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python Learning: 02相关的知识,希望对你有一定的参考价值。
OK, let‘s continue.
- Conditional Judgments and Loop
- if
- if-else
- if-elif-else
- while
- for
- break
- continue
- multiple loop
- Differences between Dict and Set
- Dict: A kind of structure in the type of "Key-Value"
- described in "{}"
- formed by "key: value"
- function "len()" to calculate the length
- judge empty:① if ‘key‘ in dict ②dict.get(‘key‘) ->if empty, return None automatically
- the key in dict is unchangeable
- Set: A kind of struture in the type of Non-repeating elements collection
- described in "set([,,,,])"
- add() to add elements
- remove() to delete elements
- Dict: A kind of structure in the type of "Key-Value"
- Functions
- where to searching functions:
http://docs.python.org/2/library/functions.html#abs
- some common functions: abs(), cmp(), int(), str(), sum()
- the Return Value of Functions
A function can return single value, as well as return more value. But in essence it returns one, a tuple. The function treats the values as a tuple.
1 >>> r = move(100, 100, 60, math.pi / 6) 2 >>> print r 3 (151.96152422706632, 70.0)
-
- recursive functions: take care of overflowing
- default parameter: set default parameter in the function line in the blankets, and the default parameter must be set at the right side
- variable parameter: use ‘*‘ to mark variable parameter , and they are regarded as a tuple
以上是关于Python Learning: 02的主要内容,如果未能解决你的问题,请参考以下文章
Deformity JSP WebshellWebshell Hidden Learning
时序差分学习(temporary learning, TD)