aboutsummaryrefslogtreecommitdiffstats
path: root/csci4041
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2020-03-02 12:10:27 -0600
committerRossTheRoss <msattr@gmail.com>2020-03-02 12:10:27 -0600
commit42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe (patch)
tree27a707300a9ade4e15bd9ac0dfd229745f575cb9 /csci4041
parentFix Collatz problem (diff)
downloadhomework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.tar
homework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.tar.gz
homework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.tar.bz2
homework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.tar.lz
homework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.tar.xz
homework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.tar.zst
homework-42af1c9c9e3bedcc362ee86ee1d7cc8a887e2ebe.zip
Thanks Jeremiah
Diffstat (limited to 'csci4041')
-rw-r--r--csci4041/hw2prob2.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/csci4041/hw2prob2.py b/csci4041/hw2prob2.py
new file mode 100644
index 0000000..c52b397
--- /dev/null
+++ b/csci4041/hw2prob2.py
@@ -0,0 +1,16 @@
+
+# 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)