Editing Examples

Let’s start with the following code.

def test():
    print('hello')
    return 5

You can use the change command to replace code. For instance, if you put your cursor on the word test and say:

change word to get

That should produce:

def get():
    print('hello')
    return 5

If you want this function to return 10 instead, you can say:

change return value to ten

That should produce:

def get(value):
    print(value)
    return 10

If you want to have this function take a parameter called value, you can say:

add parameter value

That should produce:

def get(value):
    print('hello')
    return 10

If you want to change this code to print value instead of hello, you can say:

change argument to value

That should produce:

def get(value):
    print(value)
    return 10

If you want to add another argument to the call to print, you can say:

add argument in double quotes test

That should produce:

def get(value):
    print(value, "test")
    return 10

To delete the last line of this function, you could say:

delete line 3

That should produce:

def get(value):
    print(value, "test")

To copy the print call, you could say:

copy line

Followed by:

paste

To produce:

def get(value):
    print(value, "test")
    print(value, "test")