Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.02 use of comments instead of docstring #414

Open
Dan-TEALS opened this issue Jun 27, 2022 Discussed in #346 · 0 comments
Open

3.02 use of comments instead of docstring #414

Dan-TEALS opened this issue Jun 27, 2022 Discussed in #346 · 0 comments
Assignees
Labels
Bug IntroCS.2 Low Severity Cosmetic issue that doesn't affect usability of a lesson

Comments

@Dan-TEALS
Copy link
Contributor

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:

# 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.

@Dan-TEALS Dan-TEALS added Bug IntroCS.2 Low Severity Cosmetic issue that doesn't affect usability of a lesson labels Jun 27, 2022
@Dan-TEALS Dan-TEALS self-assigned this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IntroCS.2 Low Severity Cosmetic issue that doesn't affect usability of a lesson
Projects
None yet
Development

No branches or pull requests

1 participant