Home > other >  The role of ""
The role of ""

Time:11-20

Py thon one example of the book, found that the "+" cannot be removed, remove will be submitted to the grammatical errors,
What a great god, and to explain the use of the "+" in this?

CodePudding user response:

Dr Morrison said, learn computer language, the first lesson is to print (" hello world "), you should turn to the first chapter, the book
There is obviously a normal addition and subtraction, a string with another string, no plus is equal to the print (' XXX 's) this is bad grammar, makes no sense,

CodePudding user response:

In Python, "+" has been used in the digital computing and joining together two strings, you add good here is used for string concatenation, if it's not a plus sign, belong to grammatical errors, can be replaced with

CodePudding user response:

 for s in "x" : 
Print (" circulation in the execution of ", s)
The else:
S="circulation normal close
"Print (s)

CodePudding user response:

Is a polymorphic type operator +.
Both sides is Numbers can realize mathematics addition
Both sides is string can achieve string concatenation
Both sides is a list or tuple will implement merge
If when the string formatting and other functions of digital, plus or minus

CodePudding user response:

Python, "+", can be used for digital computing and joining together two strings, of course, you can use % instead of
Such as this form: print ('. Accuracy=% 2 f % % % (ngood * 100.0/(ngood + nbad)))

CodePudding user response:

refer to the original poster m0_49284386 response:
py thon one example of the book, found that the "+" cannot be removed, remove can quote syntax errors,
What a great god, and to explain the use of the "+" in this?


Reference materials page 51 table 3.4 basic string operator

Operator: x + y description: connecting two strings x and y

Print (" circulation implementation: "+ s) in the" cycle: during the implementation of the "is a string, s is another string, so the output shows:
>
The loop execution: P
During the implementation of the circular: Y
  • Related