zoukankan      html  css  js  c++  java
  • [原创] Learning in Python:Chapter 5 Numeric Types

     1.  Built-in Numeric Tools

    • Expression operators: +, -, *, /, >>, **, &, etc.
    • Built-in mathematical functions: pow, abs, round, int, hex, bin, etc.
    • Utility Modules: random, math, etc.
    2.  Expression Operaters
     

    • Ternary selection:  x if y else z
    • Slicing:  x[i:j:k]
    3.  Other build-in Numeric Tools
    • import math
      • math.pi, math.e
      • math.sin(), math.cos(), math.tan()
      • math.sqrt()
      • math.floor(), math.trunc()
    • import random
      • random.random()
      • random.randint(1, 10)
      • random.choice()
    • pow(), abs(), sum(), min(), max(), round()
    • '%.1f' % 2.567, '{0:.2f}'.format(2.567)
    4.  Other Numeric Types
    • Decimal
    • Fraction
    • Sets
      • Unordered, immutable
      • x = set('abcde')
      • member: 'e' in x
      • difference: x - y
      • union: x | y
      • intersection: x & y
      • symmetric difference: x ^ y
  • 相关阅读:
    Django第一天
    约束条件 表之间的关系
    数据类型
    初始vue
    JQ事件和事件对象
    Jquery的属性操作和DOM操作
    浏览器对象BOM
    Swiper实现全屏视觉差轮播
    Swiper开篇
    JSON
  • 原文地址:https://www.cnblogs.com/icemoon1987/p/2708917.html
Copyright © 2011-2022 走看看