Seeing the reported error, we can find the general error . The first thing to do is to sort out the overall idea of the code , Make sure there's no problem with your thinking . Then debug the breakpoint ( The printing of each step is also OK ), In this way, the value obtained in each stage can be well obtained . Positioning error , Then it is to solve the error .
In short, the scope of error reporting solution is too broad ( It's too big ), What we need to do before solving the problem is to narrow the scope of the problem , Precise Strike

We can find that the error reported is : TypeError: Can only connect str( no "int") reach str

namely + You can only link strings , Cannot connect int( integer ) And string type , So now we will int( integer ) Cast to string , Then connect it with a plus sign

So just cast a type

character string :

String is mainly used for programming , Concept description , Function interpretation , See the text for details of usage , Here's another point : A string is stored like an array of characters , Therefore, a single element of each bit can be extracted , as s=“abcdefghij”, be s[1]=“b”,s[9]=“j”, This can provide us with a lot of convenience , For example, in high-precision operation, each bit can be converted into a number and stored in the array .

integer :
A basic technical term in computer , Refers to data without decimal parts . Integers can be decimal , Hexadecimal or octal symbol assignment , Optional symbols can be added before (- perhaps
+). Includes integer constants and integer variables , Integer variables include short integers , Basic integer , Long integer , They are divided into signed and unsigned versions , It is an intelligent computing method .

Daily Recommendation