May-06-2020, 04:46 PM
Multiline strings are commonly used to get around the limitation. The string definition needs to be properly indented. So,
""" This is an example of a multi line comment using a multi line string """ def foobar() : for idx in range (15) : print(idx) """ Done with the loop What to do next? Probably just return """ return foobar()This is also how docstrings are defined.
def fna(alpha, beta) : """ This function does nothing useful. alpha should be a number beta should be a number fna returns the sum of the numbers """ return alpha+beta print(fna.__doc__)
Output: This function does nothing useful.
alpha should be a number
beta should be a number
fna returns the sum of the numbers