0
bug or not
Strings You need to make a program for a leaderboard. The program needs to output the numbers 1 to 9, each on a separate line, followed by a dot: 1. 2. 3. ... You can use the \n newline character to create line breaks, or, alternatively, create the desired output using three double quotes """. print('1. \n2. \n3. \n4. \n5. \n6. \n7. \n8. \n9.') we also tried various ways of doing it but it doesnt work... so what wrong? code project strings
4 Antworten
+ 1
print('\n'.join( str(i) + '.' for i in range(1,10)))
+ 1
Pierre-Olivier Cartier
Your posted concept will work if you remove the spaces between each item.
print("1.\n2.\n3.\n.....etc")
The computer sees the space as a character which means the result does not match the challenge requirements.
To better understand, run/save the attached code.
Look at character 32, just because you can't see it does not mean it does not exist.
https://code.sololearn.com/cR8q6PcSDb0A/?ref=app
0
you should try
print("""
1.
2.
3.
4.
5.
6.
7.
8.
9.""")
0
Kevin Medina Baquero
ubai
Hi guys
Both your codes will work and are well presented, but giving a complete answer without an explanation of the concepts does not help the OP learn.