zoukankan      html  css  js  c++  java
  • 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
    • 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
    When you return with glory, you will be bathed in the golden rain.
  • 相关阅读:
    P1242 新汉诺塔(hanio)
    P2878 [USACO07JAN]保护花朵Protecting the Flowers
    P2096 最佳旅游线路
    [P1363] 幻想迷宫
    在矩阵上跑最小生成树
    tarjan+topsort
    tarjan缩点
    【P3398]】仓鼠找sugar
    树形数组暴力
    解决跨域问题
  • 原文地址:https://www.cnblogs.com/DrunkYouth/p/10357036.html
Copyright © 2011-2022 走看看