Piecemeal knowledge points of python review

The exam is coming soon, and I believe everyone has already reviewed the big knowledge blocks. Today, let's take a look at some of the more detailed knowledge points! ! !

  1. abs() is used to calculate the modulus length of complex numbers
  2. Python does not support the addition of characters and numbers
>>> 'a'+1
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    'a'+1
TypeError: can only concatenate str (not "int") to str
  • Then look at ------》
>>> 2**2**3
256
>>> #从右往左计算
  • Logical operation
    and: return the first false value
    from left to right or: return the first true value from left to right, and return the last value if it doesn’t match
  • ord() returns Unicode code
  • chr() returns the corresponding character
  • >>> isinstance(3,str) False
    Determine the data type
  • input() data type is string

  • Range () function review The interval of left closed and right open
range5------>范围是 0 1 2 3 4
range15------> 范围是 1 2 3 4

Welcome to follow my official account, learn together and make progress together.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45803282/article/details/111314665