diff --git a/pls.py b/pls.py index 95f4a44..7a626e7 100644 --- a/pls.py +++ b/pls.py @@ -19,8 +19,8 @@ for i in group3: sum_group_dict[sum(map(int, list(i)))].append(i) for i in sum_group_dict.keys(): - f3 = lambda number: True if '1' not in number else False - print(i, -cachesum_group_dict[i]) + f3 = lambda number: True if '7' not in number else False + print(i, list(filter(f3, sum_group_dict[i]))) # print(sum_group3_dict) # sum_group3 = [ sum(map(int, list(i))) for i in group3] # print(pd.value_counts(sum_group3).to_dict()) diff --git a/sd.py b/sd.py index 9947fdb..b762fe9 100644 --- a/sd.py +++ b/sd.py @@ -3,14 +3,43 @@ import pandas as pd a = np.arange(1000) +nums = [ f"{i:03d}" for i in a ] +is_odd = lambda i: True if int(i) % 2 == 1 else False +is_even = lambda i: True if int(i) % 2 == 0 else False + +#奇奇奇 +odd_odd_odd = [i for i in nums if is_odd(i[0]) and is_odd(i[1]) and is_odd(i[2]) ] +#奇奇偶 +odd_odd_even = [i for i in nums if is_odd(i[0]) and is_odd(i[1]) and is_even(i[2]) ] +# +odd_even_odd = [i for i in nums if is_odd(i[0]) and is_even(i[1]) and is_odd(i[2]) ] +# +odd_even_even = [i for i in nums if is_odd(i[0]) and is_even(i[1]) and is_even(i[2])] +# +even_odd_odd = [i for i in nums if is_even(i[0]) and is_odd(i[1]) and is_odd(i[2]) ] +#奇奇偶 +even_odd_even = [i for i in nums if is_even(i[0]) and is_odd(i[1]) and is_even(i[2]) ] +# +even_even_odd = [i for i in nums if is_even(i[0]) and is_even(i[1]) and is_odd(i[2]) ] +# +even_even_even = [i for i in nums if is_even(i[0]) and is_even(i[1]) and is_even(i[2])] + +print(len(even_even_even)) +print(len(even_even_odd)) +print(len(odd_odd_even)) + +f = lambda x: True if '7' not in x and '5' not in x else False +result = list(filter(f, even_odd_even)) +print(result) + l = set([ f"{i:03d}" for i in a ]) sum_dict = dict() -print(len(l)) +# print(len(l)) for i in l: _sum = sum(map(int, i)) v = sum_dict.get(_sum, 0) sum_dict[_sum] = v + 1 df = pd.Series(sum_dict) -print(df.sort_values(ascending=False)) \ No newline at end of file +# print(df.sort_values(ascending=False)) \ No newline at end of file