Answers for "docstring python types"

3

docstrings in python

# Docstrings are used create your own Documentation for a function or for a class
# we are going to write a function that akes a name and returns it as a title.
def titled_name(name):
  # the following sting is Docstring
  """This function takes name and returns it in a title case or in other
  words it will make every first letter of a word Capitalized"""
  return f"{name}".title()
Posted by: Guest on November-22-2020
1

docstring in python

"""The module's docstring"""

class MyClass:
    """The class's docstring"""

    def my_method(self):
        """The method's docstring"""

def my_function():
    """The function's docstring"""
Posted by: Guest on October-19-2021
0

Python Docstrings Example

Python Docstrings Example
def Add(a,b):
    '''Takes two number as input and returns sum of 2 numbers'''
    return a+b
Posted by: Guest on November-29-2021

Python Answers by Framework

Browse Popular Code Answers by Language