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

CodePudding user response:

reference 1st floor crifan response:
first, code logic is different, the output is different, the course,

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

Thank you, I learn seriously

CodePudding user response:

 
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 first indent print is problematic, indentation and case in python is important

CodePudding user response:

The
reference 3 floor weixin_45903952 response:
 
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 first indent print is problematic, indentation and case in python is important

Just read the upstairs brother links, study and understand, thank you
  • Related