QuackatronHQ / Gigarepo

Consider using in PYL-R1714
Performance
Major
a month ago2 years old
Consider merging these comparisons with 'in' by using 'x in (0, 1)'. Use a set instead if elements are hashable.
12        return x % 2 == 0
13
14    def is_prime(x):
15        if x == 0 or x == 1:16            return False
17
18        for i in range(2, x):
Consider merging these comparisons with 'in' by using 'x in (10, 20, 30)'. Use a set instead if elements are hashable.
140    elif x == 10 or x == 20 or x == 30 and x == 40:
141        print("Sweet!")
142
143    elif x == 10 or x == 20 or x == 30:144        print("Why even?")
145
146
Consider merging these comparisons with 'in' by using 'x in (1, 2, 3)'. Use a set instead if elements are hashable.
129
130
131def check(x):
132    if x == 1 or x == 2 or x == 3:133        print("Yes")
134    elif x != 2 or x != 3:
135        print("also true")