Skip to content
Snippets Groups Projects
homework1.py 801 B
Newer Older
  • Learn to ignore specific revisions
  • tuhe's avatar
    tuhe committed
    """
    Example student code. This file is automatically generated from the files in the instructor-directory
    """
    def reverse_list(mylist): 
    
    tuhe's avatar
    tuhe committed
        """
        Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
        reverse_list([1,2,3]) should return [3,2,1] (as a list).
        """
    
    tuhe's avatar
    tuhe committed
        # TODO: 1 lines missing.
        raise NotImplementedError("Implement function body")
    
    tuhe's avatar
    tuhe committed
    
    
    tuhe's avatar
    tuhe committed
    def add(a,b): 
    
    tuhe's avatar
    tuhe committed
        """ Given two numbers `a` and `b` this function should simply return their sum:
        > add(a,b) = a+b """
    
    tuhe's avatar
    tuhe committed
        # TODO: 1 lines missing.
        raise NotImplementedError("Implement function body")
    
    tuhe's avatar
    tuhe committed
    
    if __name__ == "__main__":
        # Problem 1: Write a function which add two numbers
        print(f"Your result of 2 + 2 = {add(2,2)}")
        print(f"Reversing a small list", reverse_list([2,3,5,7]))