zoukankan      html  css  js  c++  java
  • 20201228-1 数字

    Numbers
    2-1
    >>> 2 + 2
    4
    >>> 50 - 5*6
    20
    >>> (50 - 5*6) / 4
    5.0
    >>> 8 / 5  # division always returns a floating point number
    1.6
    
    2-2
    >>> 17 / 3  # classic division returns a float
    5.666666666666667
    >>>
    >>> 17 // 3  # floor division discards the fractional part
    5
    >>> 17 % 3  # the % operator returns the remainder of the division
    2
    >>> 5 * 3 + 2  # result * divisor + remainder
    17
    
    2-3
    >>> 5 ** 2  # 5 squared
    25
    >>> 2 ** 7  # 2 to the power of 7
    128
    
    3-1
    In interactive mode, the last printed expression is assigned to the variable _. 
    This means that when you are using Python as a desk calculator, 
    it is somewhat easier to continue calculations, for example:
    
    >>> tax = 12.5 / 100
    >>> price = 100.50
    >>> price * tax
    12.5625
    >>> price + _
    113.0625
    >>> round(_, 2)
    113.06
    
    This variable should be treated as read-only by the user. 
    Don’t explicitly assign a value to it — you would create an independent local variable 
    with the same name masking the built
    -in variable with its magic behavior.
  • 相关阅读:
    Banner实现无线轮播
    二维码生成
    自定义View圆环
    百度地图
    OkHttp解析
    自定义控件生成随机数
    OkHttp中文文档
    Da购物车
    Angular过滤器
    popupWindow
  • 原文地址:https://www.cnblogs.com/azxsdcv/p/14202257.html
Copyright © 2011-2022 走看看