Skip to content
Snippets Groups Projects
Commit 240dc8e5 authored by tuhe's avatar tuhe
Browse files

Reorg for new version

parent 80604368
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 19 deletions
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -6,7 +6,7 @@ import random ...@@ -6,7 +6,7 @@ import random
class Week1(UTestCase): class Week1(UTestCase):
""" The first question for week 1. """ """ The first question for week 1. """
def test_add(self): def test_add(self):
from cs103.homework1 import reverse_list, my_sum, add from cs103.homework1 import add
self.assertEqualC(add(2,2)) self.assertEqualC(add(2,2))
self.assertEqualC(add(-100, 5)) self.assertEqualC(add(-100, 5))
......
...@@ -6,13 +6,13 @@ import random ...@@ -6,13 +6,13 @@ import random
class Week1(UTestCase): class Week1(UTestCase):
""" The first question for week 1. """ """ The first question for week 1. """
def test_add(self): def test_add(self):
from cs103.homework1 import reverse_list, my_sum, add from cs103.homework1 import add
self.assertEqualC(add(2,2)) self.assertEqualC(add(2,2))
self.assertEqualC(add(-100, 5)) self.assertEqualC(add(-100, 5))
@hide @hide
def test_add_hidden(self): def test_add_hidden(self):
from cs103.homework1 import reverse_list, my_sum, add from cs103.homework1 import add
self.assertEqualC(add(2,2)) self.assertEqualC(add(2,2))
import cs103 import cs103
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
""" """
Example student code. This file is automatically generated from the files in the instructor-directory Example student code. This file is automatically generated from the files in the instructor-directory
""" """
def reverse_list(mylist): #!f def reverse_list(mylist):
# TODO: Your solution here """
result = [] Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
for k in mylist: reverse_list([1,2,3]) should return [3,2,1] (as a list).
result = [k] + result """
# TODO: 1 lines missing.
return result raise NotImplementedError("Implement function body")
def add(a,b): #!f def add(a,b):
return a+b """ Given two numbers `a` and `b` this function should simply return their sum:
> add(a,b) = a+b """
# TODO: 1 lines missing.
raise NotImplementedError("Implement function body")
if __name__ == "__main__": if __name__ == "__main__":
# Problem 1: Write a function which add two numbers # Problem 1: Write a function which add two numbers
......
...@@ -9,7 +9,7 @@ import random ...@@ -9,7 +9,7 @@ import random
class Week1(UTestCase): class Week1(UTestCase):
""" The first question for week 1. """ """ The first question for week 1. """
def test_add(self): def test_add(self):
from cs103.homework1 import reverse_list, my_sum, add from cs103.homework1 import add
self.assertEqualC(add(2,2)) self.assertEqualC(add(2,2))
self.assertEqualC(add(-100, 5)) self.assertEqualC(add(-100, 5))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment