Skip to content

Clean up scripts/check.py — junk comments and print(func1) never calls the function #18

Description

@utk2103

scripts/check.py is not usable as a teaching example.

def func1():
    # Why: Placeholder function for structure
    # utka
    # utkasfjh      <- leftover keyboard-mashing
    # jlfdjlj
    # jrlfjl
    print(func1)    # prints "<function func1 at 0x...>", not a call

Two problems: four lines of junk comments, and print(func1) prints the function object — which is exactly the mistake beginners make and then get confused by. A file named check.py also tells nobody what it demonstrates.

What to do

  • Delete the junk comments.
  • Make the function do something real and print its return value.
  • Add a short comment contrasting print(func1) (the object) with print(func1()) (the result) — turn the bug into the lesson.
  • Rename the file to what it teaches, e.g. functions_and_input_demo.py, and update any reference to it.

Good first issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions