How to Use

To get started with Pair Programmer, you will need to specify programming language you are using or want to use. By default, the field is set to Python.

Once you submit your programming language, you will receive a message similar to the one below (although the exact wording may differ) that details what Pair Programmer has to offer and provides some useful commands:

If everything looks correct, you can then write your programming question into the prompt area.

/change

The /change command allows you to modify your preferences when interacing with Pair Programmer. Currently, it supports two options:

  • Programming language – Switch programming language. For example, enter /change language=Java to switch to Java.

  • Interaction language – Change the language. For example, enter /change language=Spanish to switch to Spanish.

/implement

The /implement command is used when you want to create a new program. It follows a five-step procedure to ensure a thorough approach:

For example, you could input/implement task=TaskDescription. Please replace TaskDescription with a description of the task you want to be implemented.

Example

Let's say you want to implement a program that calculates the sum of all elements in a list.

/implement task=Create a Python function that calculates the sum of all elements in a list. The function should take a list of integers as input and return an integer as output.

/modify

The /modify command is used when you want changes or adjustments made to an existing program. Input /modify code=ProgramCode modifications=ProgramModification. Please replace ProgramCode with the program you want to modify, and ProgramModification with a description of what you want to change.

Example

For example, imagine you have a Python function that calculates the area of a rectangle, and you want to modify it to calculate the area of a circle instead.

/modify code=
def rectangle_area(length, width):
    return length * width

modifications=
Change the function to calculate the area of a circle instead, using the formula `pi * radius^2`. The function should take a single argument for the radius.

/test

The /test command is used when you want me to create test cases for a given program. Input /test code=ProgramCode description=ProgramDescription. Please replace ProgramCode with the program you want to test, and ProgramDescription with a description of what the program does.

Example

Let's say you have a Python function that calculates the factorial of a number and you want to create test cases for it

/test code=
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

description=
This function calculates the factorial of a given number. The factorial of a number n is the product of all positive integers less than or equal to n.

Regenerate response

If you are want to run a prompt again, click the Regenerate response button. It will regenerate the answer to the last prompt you submitted.

Note – The output from the first iteration will be replaced with the regenerated response.

Last updated