You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jdonwells February 11, 2022
Python has something called a docstring to add documentation to a function in a standardized way.
3.02 shows this:
# Name: multiply_by_two
# Purpose: multiplies a given number by 2
# Input: number to multiply (int)
# Output: int
def multiply_by_two(a):
c = a * 2
return c
Instead, I would recommend this:
def multiply_by_two(a):
"""
Name: multiply_by_two
Purpose: multiplies a given number by 2
Input: number to multiply (int)
Returns: int
"""
c = a * 2
return c
Many IDEs will know about docstrings and display them as you write code.
The text was updated successfully, but these errors were encountered:
Discussed in #346
Originally posted by jdonwells February 11, 2022
Python has something called a docstring to add documentation to a function in a standardized way.
3.02 shows this:
Instead, I would recommend this:
Many IDEs will know about docstrings and display them as you write code.
The text was updated successfully, but these errors were encountered: