Home > other > How to solve the proper use of the print
How to solve the proper use of the print
Time:04-28
Strings=[' aa ', 'bb', 'cc', 'dd'] Result=[] For string in strings: For the results in string: Result. Append (results) Print (result)
Strings=[' aa ', 'bb', 'cc', 'dd'] Result=[] For string in strings: For the results in string: Result. Append (results) Print (result)
The results of the two output is different from the result, append (results) enter down is bringing the indentation, is this why?
CodePudding user response:
First of all, the code logic is different, the output is different, is of course ah,
Here, not the problem of the print, but: do you think of two pieces of code logic is the same as
Why do you think code logic, estimation is: don't understand in Python code logic, is actually affect code logic
On the code indentation, see: Code indent Python beginners small white common errors and problems And: [tutorial], a Python code indentation (Indent) : the internal logic relationship affect code and results - in the way