0

Create a program to output numbers 1,2 and 3 each on a separate line

Python

7th Dec 2021, 4:03 PM
Shreya Yadav
5 ответов
+ 4
print(1, 2, 3, sep = '\n') # the numbers will be printed usually with a space as separator. but we can define a different separator. in this case it is a new-line sequence. this is also a common way: for i in [1,2,3]: print(i) or by using a list comprehension: [print(i) for i in [1,2,3]]
7th Dec 2021, 4:56 PM
Lothar
Lothar - avatar
+ 1
print('1\n'+'2\n'+'3')
7th Dec 2021, 4:15 PM
JaScript
JaScript - avatar
+ 1
You can use more print, like: print(1) print(2) or try to google end=' '
7th Dec 2021, 4:15 PM
Mishel Kartavy
Mishel Kartavy - avatar
0
How I changed line to print 1,2 and 3 in python.because there no /n.
7th Dec 2021, 4:10 PM
Shreya Yadav
0
Enter·the·first·number:·1 Enter·the·second·number:·2 1·+·2·=·3 how to prog ram this when the output is this
15th Oct 2022, 2:42 PM
alexis patac
alexis patac - avatar