From 3b7b4a6dd33bdd5698de64e3e6b384998349f538 Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Wed, 30 Nov 2022 18:54:52 +0000 Subject: [PATCH] Test single-line if. --- main.py | 74 ++++----------------------------------------------------- 1 file changed, 5 insertions(+), 69 deletions(-) diff --git a/main.py b/main.py index ebf70a3..0a2a552 100644 --- a/main.py +++ b/main.py @@ -1,69 +1,5 @@ -#Test collection stuff -a=[1,2,3] -b=[4,5] -print(a, b) -a.append(4) -print(a) -a.remove(4) -print(a) -a.extend(b) -print(a) -a.pop(3) -print(a) -a.insert(3,4) -del a[0] -print(a) -del a[1:3] -print(a) -del a -print(b.clear()) -print(b) -c = [1, 2, 3, 4, 5,6, 7] -d = [print(x) for x in c] -print(d) -#x = [expr_fill_list for item in itr if cond == True] -#Condition is optional -e = [x for x in c if x%2 == 1] -print(e) -f = [x if x%2 == 1 else None for x in c] -print(f) -c.sort(reverse=True) -print(c) -c.sort() -print(c) -def sk(n): - return n%2 == 0 -#key defines the function that provides the values for sorting -c.sort(key=sk) -print(c) -d = c.copy() -e = list(c) -d.clear() -e.insert(1, "A") -print(e) -print(d) -print(c) -b.extend((4,5,6,7,8)) -print(b) -#* Means stick any remaining values as a collection in this variable, however the variables are still populated in order -*g, h, i = b -print(g,h,i) -j = (1, 2) -k = (3, 4, 5) -l = j + k -print(l) -print(k*3+l) -m = {1, 2, 3} -n = {3, 4, 5} -o = m.union(n) -print(o) -n.update(m) -print(n) -m = {1, 2, 3} -n = {3, 4, 5} -p = m.symmetric_difference(n) -print(p) -o = m.intersection(n) -print(o) -n.intersection_update(m) -print(n) +#1 Line Ifs +x = None +if x is None: print("Oh") +#x = " " +print("Why") if x is None else print ("No")