python number and string

1.lists are medium brackets.for example age = [2,3,56,9]

2.dictionary tables are brackets for example name={‘xiaoming’:30, ‘huahua’:80,‘gender’:‘kk’}
there are two ways to index numeric values in a dictionary.
one is an index key in the forn of name [‘xiaoming’],
the other is to use get() function, such as name.get(‘gender’),
which can be assignde if there is no key in get , such as name.get(‘age’,20)
the name dictionary adds an age key and assigns 20

3.tuples are parentheses, and no subscript index can be used to modify values, for example big =(1,2,1,1,1)
lists can be modified by index values

5.use ‘{0:.2f}’.format(variable) for data formatting, which means keeping two decimal digits在这里插入图片描述
6.unequal symbols are ‘!=’

7.method of keeping integers only
(1) ‘//’ is retain integer and retain high precision for example 10//4.0 >>>2.0
(2) the math.floor integer part is the value of the coordinate axis near the left
(3) math.trunc is the reserved value approcaching zero
(5) round is rounded(四舍五入)
在这里插入图片描述
8. other digits correspond to decimal values
0o stands for octal 0x for hexadecimal 0b for binary, 8421 method inbinary system
在这里插入图片描述
9. the decimal system is converted to other systems as shown below
在这里插入图片描述
9. using decimal module to make the numerical value more precise
在这里插入图片描述
10. ‘’’ ‘’’ marks define a description document,

  1. common use of signle and double quotation marks are used as follows
    在这里插入图片描述
  2. commonly used backslash and its meaning for example \n mean line feed,\t mean enter four spaces \a mean bell
  3. in the statement we can add r so that what we declare is what we export so as follows
    在这里插入图片描述
    15 some common operations of strings, as shown below
    在这里插入图片描述
    在这里插入图片描述
    16 when a value needs to be changed frequently, it can be defined as a list and then coverted into a string
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    17 a method of segmenting strings and judging the first character and end it。 as follows
    在这里插入图片描述
  4. find an index of the location of an element
    在这里插入图片描述
    19.Examples of Format Use
    在这里插入图片描述
  5. the types in the array are consistent , and the data types in the list can be different
    21.‘in ’ special words can determine whether a data is in the list or not as follows
    在这里插入图片描述
  6. some other uses
  7. 在这里插入图片描述
  8. in the replacement of elements in the list, the principle of selecting values in the list is to leave the values in front and the final values should not be ,such as[1;2], the values at position 2 shuold be rounded off
    在这里插入图片描述
  9. addition an element to a list and extending a list of list as shown below
  10. 在这里插入图片描述
  11. list support in-siu changes,but string do not support in-situ changes,in-situ changes are changes,after nonin-situ changes are changed, the original object needs to be reassigned to save the changed amount
  12. 在这里插入图片描述
  13. 在这里插入图片描述
  14. 在这里插入图片描述
  15. multiple objects point to the same reference, modify a variable and other variables point to the reference change
  16. if copy assignment is used it will not change at the same time following chart
  17. 在这里插入图片描述
  18. 在这里插入图片描述
    summary
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值