0
Newline and (""") Qoutes
Anyone can explain easily.. With simple example
4 ответов
0
Hi Roshita.
The three quotation marks (""") are used to skip typing (\n) within your code to tell Python to print what follows it into a new line.
For example, take the following text:
Customer: Good morning.
Owner: Good morning, Sir. Welcome to the National Cheese Emporium.
As you can see we want to print what the Customer says on one line, then print the reply of the Owner on a different line (new line).
To do this in Python, you either need to use (\n):
print("Customer: Good morning.\nOwner: Good morning, Sir. Welcome to the National Cheese Emporium.")
The interpreter will actually skip the (\n), without printing it, and prints anything that follows on a new line.
Or, use (""") instead, and move to a new line within your code, without the need for (\n):
print("""Customer: Good morning.
Owner: Good morning, Sir. Welcome to the National Cheese Emporium.""")
In the second option, your code looks like the actual output.
Hope this clears it out.
Cheers.
+ 1
Tqq asem soufi....
0
Can you please say explain about (""") quotes
- 1
New line is as like in c and c++. Use \n to have a new line in your output for your convenience.
Quotes could be a tricky one though , but if you want you to make it fell easy for you , then use "" to the print statement if the statements consists of (for example : A man's life) like sentences/words , it could be executed like having the code:
>>>>print("A man\'s life")
Should you execute the above line , the output will be
A man's life.
So that's it from me.