DM587 (E24) - Scientific Programming

Assignment 0: Try out

Submission Deadline: Moonday, October 28, 2024, at noon

  • You find the specifications file in your git repository (it is also copied below).

  • Submissions are via git.

  • Read Appendix A from [HJ1] for submission details.

  • You do not need to submit or take any action in ItsLearning.

  • To assess your results visit https://dalila.imada.sdu.dk (you will not receive the file named grades.txt).

"""
asg-tryout

The goal of this first lab is testing your setup. The submission will
be graded but it will not count for the final assessment.

Your task is to implement the functions below. See the /docstring/ of
the function for the purpose of the function.

The function /docstring/s contain also real examples and usage of the
functions. You can run these examples by executing the script from
command line:

python3 tryout.py

Note that the unit tests may contain different tests.
"""


def squares():
    """
    Returns a list of the squares of the first ten natural
    numbers. Try using list comprehensions.

    Parameters
    ----------
    None
    
    Returns
    -------
    list(int)
        A list of integer numbers

    Examples
    --------
    
    >>> squares()
    [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
    """
    pass



def multiples(arg):
    """
    Returns a list of numbers in the range [0,100] that are multiples of arg. 

    Parameters
    ----------
    arg : int
        the multiplier

    Returns
    -------
    list(int)
        Description of return value

    Examples
    --------
    
    >>> multiples(4)
    [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100]
    """
    pass



def sum_lists(arg1, arg2):
    """
    Return a list that is the element-wise sum of the elements of the
    two lists of equal size passed as arguments.

    Lists can be used to represent vectors of numbers as in Linear
    Algebra. However, as you can test in a python shell, for example,
    `ipython`, the effect the operator `+` is not really the expected
    one in linear algebra.

    Parameters
    ----------
    arg1 : list(numeric)
        a list of numbers
    arg2 : list(numeric)
        a list of numbers

    Returns
    -------
    list(int)
        a list containing the element-wise sum of the two lists

    Raises
    ------
    ValueError
        If the two lists are not of equal size
        that are relevant to the interface.


    Examples
    --------
    
    >>> va = [1, 1, 1]
    >>> vb = [2, 2, 2]
    >>> sum_lists(va,vb)
    [3, 3, 3]
    """

    pass



if __name__ == "__main__":
    import doctest
    doctest.testmod()