Click here to Skip to main content
15,912,977 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
What do the three " mean in a function (in python) with a message in it?
Can't we use a # for such a report? Here is an example of what I n:

def make_sandwich(*items):
    """Make a sandwich with the given items."""
    print("\nI'll make you a great sandwich:")
    for item in items:
        print("  ...adding " + item + " to your sandwich.")
    print("Your sandwich is ready!")

So what i mean is the first sentence under de def ("""Make a sandwish with the given items.""")

Thank you

What I have tried:

Tried to find it on google but no sucess
Posted
Updated 7-Mar-19 9:24am

That is a question that includes 2 questions, one about the data type, and second the purpose of that placement.

First of, as Solution 1 answers, that is a string definition. In Python, you are not restrained to use a single quote to create a string, you can use multiple ways and this triple double quote is one of them.

And as far as the placement is concerned, that placement makes this string a comment for the function. Thus, anyone trying to use the function will be able to see this as a helper comment. For that, see here What is the proper way to comment functions in python? - Stack Overflow[^]
 
Share this answer
 
Your google-fu needs some work - a trivial google found loads: python three double quotes - Google Search[^]
And straight to here: Python Strings  |  Python Education  |  Google Developers[^]
 
Share this answer
 
Thank you guys, i'm new to programming:) But i think you noticed that haha
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900