当前位置: 移动技术网 > IT编程>脚本编程>Python > Python Learning: 02

Python Learning: 02

2019年02月11日  | 移动技术网IT编程  | 我要评论

娇妻耍大牌txt,大学挂科有什么影响,野菱

  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
  • 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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网