Skip to content

The generated comments is strange #1

@myuanz

Description

@myuanz

I wrote the following code:

from typing import List

def is_even(numbers: List[int]) -> List[bool]:
    '''
    Take True for even numbers and False for odd numbers, return them as a list.
    Write three call examples in the comment.

And got:

from typing import List

def is_even(numbers: List[int]) -> List[bool]:
    '''
    Take True for even numbers and False for odd numbers, return them as a list.
    Write three call examples in the comment.

    >>> is_even([2])
    [True]
    >>> is_even([1, 3, 5, 7, 9])
    [True, False, False, True]
    >>> is_even([])
    [False]
    '''

    even_numbers = []

    for number in numbers:
        if number % 2 == 0:
            even_numbers.append(True)
        else:
            even_numbers.append(False)

    return even_numbers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions