python function docstring
def functionName():
"""
This is a function docstring
"""
python function docstring
def functionName():
"""
This is a function docstring
"""
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()
python docstring
def complex(real=0.0, imag=0.0):
"""Form a complex number
Args:
real (float, optional): The real part. Defaults to 0.0.
imag (float, optional): The imaginary part. Defaults to 0.0.
"""
if imag == 0.0 and real == 0.0:
return complex_zero
...
using docstring in python
#A docstring is a string literal that occurs as the first statement in a module,
#function, class, or method definition. Such a docstring becomes the __doc__ special
#attribute of that object.
#They serve as documentation or explanation to a statement in a function, class or
#method definition. They are kept in a triple quotation mark.
def complex(real=0.0, imag=0.0):
"""Form a complex number.
Keyword arguments:
real -- the real part (default 0.0)
imag -- the imaginary part (default 0.0)
"""
if imag == 0.0 and real == 0.0:
return complex_zero
...
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us