Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.54 KB

Contribute.md

File metadata and controls

35 lines (24 loc) · 1.54 KB

How to add a new challange?

  1. Fork this project if you haven't done so

  2. Determine how difficult the challenge is. There are 4 levels: basic, intermediate, advanced, and extreme.

  3. Create a new directory under challenges/. The new directory's name should follow the pattern [basic|intermediate|advanced|extreme]-name.

    For example, say you want to add a new challenge about Protocols. Since this is an advanced topic, you may name the directory advanced-protocol.

  4. Put a question.py and a solution.py in the new directory. Here's an example question.py:

    """
    TODO:
      foo should accept a dict argument, both keys and values are string.
    """
    
    def foo(x):
        pass
    
    ## End of your code ##
    foo({"foo": "bar"})
    foo({"foo": 1})  # expect-type-error

    You want to include several things in question.py:

    • Describe the challenge, make sure people understand what they need to accomplish (i.e. the TODO: part)
    • A comment ## End of your code ##. This is mandatory, just copy and paste it.
    • Several test cases. Add a comment # expect-type-error after the lines where type errors should be thrown.

    solution.py contains the right solution, with everything else unchanged.

  5. Test with pyright to make sure your new challenge works as expected.

  6. Create a Pull Request.