What Good are Functions? Lesson Intro, Quick question [SOLVED]


I recall that when writing comments in python, we use # which returns a line of grey text.
Why is """ use in this case? What is the difference?

def tax(bill):
    """Adds 8% tax to a restaurant bill."""


There are two styles of comments in python

# single line comment

" " " this is a multiline comment
which spawns many lines " " " - Comments in Python


They aren't comments, but they can be used as such because python ignores values that are not used. Strings used that way at the beginning of a module, class, or function are an exception, they become docstring attributes to those objects


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.