From 9deabe475c28a7547522be62bc263143db9bf721 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sat, 9 May 2020 14:09:47 -0500 Subject: rearrange homework folders --- OLD/csci4041/hw2prob2.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 OLD/csci4041/hw2prob2.py (limited to 'OLD/csci4041/hw2prob2.py') diff --git a/OLD/csci4041/hw2prob2.py b/OLD/csci4041/hw2prob2.py new file mode 100644 index 0000000..39e533a --- /dev/null +++ b/OLD/csci4041/hw2prob2.py @@ -0,0 +1,18 @@ + +# Watch the value of K!!! +# - Jeremiah +def making_sets(n, k, e, s): + if k == 0: + print(s) + else: + for e_i in range(e, n + 1): + s = set.union(s, {e_i}) + making_sets(n, k - 1, e_i + 1, s) + s = set.difference(s, {e_i}) + +def make_sets(n, k): + making_sets(n, k, 1, set()) + +make_sets(4,3) +print() +make_sets(6,1) -- cgit v1.2.3