+ 1

Exercice

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 """. Voici ce que j'ai essayé : Print ( 1. \n 2. \n 3. \n 4. \n 5. \n 6. \n 7. \n 8. \n 9. )

11th Aug 2021, 11:54 PM
ARISTIDE ON-KEBA YAGO DERING
ARISTIDE ON-KEBA YAGO DERING - avatar
6 Antworten
+ 2
Your code has three issues: 1. Python is case sensitive, so it has to be "print", not "Print". 2. You're printing a string, so you need to use quotation marks. 3. Python prints the spaces. So, while they do make your code more readable, they screw up the result. print("1.\n2.\n3.\n4.\n5.\n6.\n7.\n8.\n9.")
12th Aug 2021, 1:18 AM
Simon Sauter
Simon Sauter - avatar
+ 2
➵Chloe it's for a course project, so the result has to be exactly what sololearn expects, so no additional spaces, etc. But points 1 and 2 are necessary for the code to run without errors.
12th Aug 2021, 1:22 AM
Simon Sauter
Simon Sauter - avatar
+ 2
Simon Sauter oh, I see. I thought it was just a project and the print statement was a product of autocorrect of some sort. Thanks for the clarification!
12th Aug 2021, 1:25 AM
Chloe
Chloe - avatar
+ 2
J'ai oublié de mettre les guillemets ici. Sinon dans mon programme je l'ai mis. Je crois que mon véritable problème ce sont les espaces. Si vous serez disponibles pour m'aider, je vais donner des exercices et avec des propositions. Merci beaucoup pour vos éclaircissements !
12th Aug 2021, 5:22 AM
ARISTIDE ON-KEBA YAGO DERING
ARISTIDE ON-KEBA YAGO DERING - avatar
+ 1
I don't see the issue, the code works fine?
12th Aug 2021, 1:19 AM
Chloe
Chloe - avatar
+ 1
➵Chloe I see you completed the Python for Beginners course, so once upon a time you must have done the same project. It comes at the end of the Strings section. :)
12th Aug 2021, 1:29 AM
Simon Sauter
Simon Sauter - avatar