1# Docstrings are used create your own Documentation for a function or for a class
2# we are going to write a function that akes a name and returns it as a title.
3def titled_name(name):
4 # the following sting is Docstring
5 """This function takes name and returns it in a title case or in other
6 words it will make every first letter of a word Capitalized"""
7 return f"{name}".title()
1def complex(real=0.0, imag=0.0):
2 """Form a complex number
3
4 Args:
5 real (float, optional): The real part. Defaults to 0.0.
6 imag (float, optional): The imaginary part. Defaults to 0.0.
7 """
8 if imag == 0.0 and real == 0.0:
9 return complex_zero
10 ...
11
1def function1():
2 """
3 :docstring- tells about program,what the program contains
4 """
1"""The module's docstring"""
2
3class MyClass:
4 """The class's docstring"""
5
6 def my_method(self):
7 """The method's docstring"""
8
9def my_function():
10 """The function's docstring"""