for elem in [10, 20, 25, 27, 28.5]:
print(elem),
But the results are
10
20
25
27
28.5
How can I make the results in one line? Like
10 20 25 27 28.5
I know I can use
print([elem for elem in [10, 20, 25, 27, 28.5]])
Hi experts,I am using python 3.
for elem in [10, 20, 25, 27, 28.5]:
print(elem),
But the results are
10
20
25
27
28.5
As I learned, the comma in the syntax "print(elem)," will prevent the use of newline character. Why does it not work here?How can I make the results in one line? Like
10 20 25 27 28.5
I know I can use
print([elem , end=',')
but doing this i am getting commas i dont need commas
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+unsubscribe@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at https://groups.google.com/group/spyderlib.
for elem in [10, 20, 25, 27, 28.5]:
#instered of using this print(elem),
#use
print(elem,end=' ') #space in inverted comma.
thanks