首页 > 编程语言 > 详细

Python Learning: 02

时间:2019-02-11 00:43:58      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:lec   abs   mov   describe   ram   som   between   int   values   

  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

        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

标签:lec   abs   mov   describe   ram   som   between   int   values   

原文:https://www.cnblogs.com/DrunkYouth/p/10357036.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 bubuko.com 版权所有 鲁ICP备09046678号-4
打开技术之扣,分享程序人生!
             

鲁公网安备 37021202000002号