0

how can i make output in single line like 1 a 2 c

28th Dec 2020, 9:04 AM
Karthik C
Karthik C - avatar
15 Réponses
+ 8
end="" puts no spaces between them and end="," puts commas between them without spaces.
28th Dec 2020, 9:28 AM
David Ashton
David Ashton - avatar
+ 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
28th Dec 2020, 9:18 AM
David Ashton
David Ashton - avatar
+ 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
28th Dec 2020, 9:18 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 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 ...
28th Dec 2020, 9:22 AM
Ipang
+ 2
print("1a2b") ?
28th Dec 2020, 9:16 AM
Arsenic
Arsenic - avatar
+ 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?
28th Dec 2020, 9:09 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Like that 1a 2 b 3 c 4 d?
28th Dec 2020, 9:13 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
write like this: print("1",end=" ") print("a")
28th Dec 2020, 9:20 AM
The future is now thanks to science
The future is now thanks to science - avatar
0
not to print 1 a 2 c i want make output by print 1,a,.. separetly in one line without space
28th Dec 2020, 9:12 AM
Karthik C
Karthik C - avatar
0
s like 1a2b
28th Dec 2020, 9:13 AM
Karthik C
Karthik C - avatar
0
not like that
28th Dec 2020, 9:17 AM
Karthik C
Karthik C - avatar
0
print("1") print("a") out must be 1a like this
28th Dec 2020, 9:19 AM
Karthik C
Karthik C - avatar
0
ok thank you so much who to help me
28th Dec 2020, 9:21 AM
Karthik C
Karthik C - avatar
0
ok sure
28th Dec 2020, 9:29 AM
Karthik C
Karthik C - avatar
- 1
ok
28th Dec 2020, 9:23 AM
Karthik C
Karthik C - avatar