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

Updates

parent dadd26b9
Branches
No related tags found
No related merge requests found
Showing
with 834 additions and 38 deletions
This diff is collapsed.
No preview for this file type
No preview for this file type
File added
File added
File added
File added
from report1flat import Report1Flat
from unitgrade_private2.hidden_create_files import setup_grade_file_report
from snipper import snip_dir
if __name__ == "__main__":
setup_grade_file_report(Report1Flat, minify=False, obfuscate=False, execute=False)
# from unitgrade_private2.hidden_gather_upload import gather_upload_to_campusnet
# gather_upload_to_campusnet((Report1Flat()))
# Deploy the files using snipper: https://gitlab.compute.dtu.dk/tuhe/snipper
snip_dir.snip_dir(source_dir="", dest_dir="../../students/cs101flat", clean_destination_dir=True, exclude=['__pycache__', '*.token', 'deploy.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
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]))
from src.unitgrade2.unitgrade2 import Report
from src.unitgrade2 import evaluate_report_student
from homework1 import reverse_list, add
import unittest
class Week1(unittest.TestCase):
def test_add(self):
self.assertEqual(add(2,2), 4)
self.assertEqual(add(-100, 5), -95)
def test_reverse(self):
self.assertEqual(reverse_list([1,2,3]), [3,2,1])
import homework1
class Report1Flat(Report):
title = "CS 101 Report 1"
questions = [(Week1, 10)] # Include a single question for 10 credits.
pack_imports = [homework1]
if __name__ == "__main__":
# Uncomment to simply run everything as a unittest:
# unittest.main(verbosity=2)
evaluate_report_student(Report1Flat())
This diff is collapsed.
File added
File added
File added
File added
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment