Skip to content
Snippets Groups Projects
Select Git revision
  • c37f8b0753cb0fdaa1a982784fbb9a1cad9b83aa
  • master default protected
2 results

index.html

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    homework1.py 604 B
    # autolab_example_py_upload/instructor/cs102_autolab/homework1.py
    def reverse_list(mylist): #!f 
        """
        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).
        """
        return list(reversed(mylist))
    
    def add(a,b): #!f
        """ Given two numbers `a` and `b` this function should simply return their sum:
        > add(a,b) = a+b """
        return a+b*2
    
    if __name__ == "__main__": # Example usage:
        print(f"Your result of 2 + 2 = {add(2,2)}")
        print(f"Reversing a small list", reverse_list([2,3,5,7]))