Printing values in a vertical column format in Python
Question:
Is there a way to print the values of list A
in a vertical column format? I present the current and expected outputs.
A=[0.021090000000000005, 0.019535125946503053, 0.019398647830541613]
print(A)
The current output is
[0.021090000000000005, 0.019535125946503053, 0.019398647830541613]
The expected output is
[0.021090000000000005,
0.019535125946503053,
0.019398647830541613]
Answers:
You can do this:
a = [1, 2, 3, 4]
for c in a:
print(c)
You can always use the print function to format your output as you want.
print(*A, sep='n')
This will add a newline after each element.
Is there a way to print the values of list A
in a vertical column format? I present the current and expected outputs.
A=[0.021090000000000005, 0.019535125946503053, 0.019398647830541613]
print(A)
The current output is
[0.021090000000000005, 0.019535125946503053, 0.019398647830541613]
The expected output is
[0.021090000000000005,
0.019535125946503053,
0.019398647830541613]
You can do this:
a = [1, 2, 3, 4]
for c in a:
print(c)
You can always use the print function to format your output as you want.
print(*A, sep='n')
This will add a newline after each element.