+ 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!

28th Mar 2018, 8:28 PM
Chris
Chris - avatar
2 Answers
+ 2
print("spam\n" * 3)
28th Mar 2018, 8:31 PM
Vladi Petrov
Vladi Petrov - avatar
- 1
we neet to keep backward slash bt u have used forward slash try it once keeping backward slash
31st Mar 2018, 6:08 AM
satya Susmitha
satya Susmitha - avatar