0
how can i make output in single line like 1 a 2 c
15 Answers
+ 8
end="" puts no spaces between them and end="," puts commas between them without spaces.
+ 8
You can use the end= parameter in the print function. The default is a new line but you can change it to e.g. a space.
for i in "1a2c":
print(i)
outputs
1
a
2
c
for i in "1a2c":
print(i, end=" ")
outputs
1 a 2 c
+ 4
okay I think you know the code how to do this.You just need to know how can you print anything without going to another line right?
Then you have to use the keyword end with print statement.
Here is an example:
https://code.sololearn.com/cz6LRUmBeG3t/?ref=app
+ 3
Karthik C
Please provide precisely how the desired output should be. In original post you wrote 1 a 2 c (spaces in between). But recently you write 1a2b.
Don't confuse the people ...
+ 2
print("1a2b") ?
+ 1
Are you talking about pattern?
Or you just want to print("1 a 2 c")?
If you are talking about pattern then can you please show some more example?
+ 1
Like that 1a 2 b 3 c 4 d?
+ 1
write like this:
print("1",end=" ")
print("a")
0
not to print 1 a 2 c
i want make output by print 1,a,.. separetly in one line without space
0
s like 1a2b
0
not like that
0
print("1")
print("a")
out must be
1a like this
0
ok thank you so much
who to help me
0
ok sure
- 1
ok