+ 3
Python Tutorial - "Spam" Example Question
So on one of the latter lessons in the first module for the Python course, we are presented with this line of code and result: >>> print("spam" * 3) spamspamspam I was just wondering how I could make it to where each string would appear on a separate line, where instead of: spamspamspam it would read: spam spam spam My attempt at the solution was to put a /n somewhere, but I kept getting errors. Sorry for the basic and (seemingly) incredibly easy question that could have probably been asked with less lines, but I'm completely green with this stuff. Thanks in advance!
2 Réponses
+ 2
print("spam\n" * 3)
- 1
we neet to keep backward slash bt u have used forward slash try it once keeping backward slash