would you like to try this code which simplify the flow and make it more Pythonic
:
nums = map(int, input("Input some numbers: ").split()) # get all numbers in one shot
results = [[], []] # declare the results to store evens and odds
for n in nums: # put each number in their own list or bucket. one shot.
results[n % 2].append(n)
print(results)
evens, odds = results # unpacking these 2 lists
print(f' evens list: {evens}' ) # confirm the results is ok
print(f' odds list: {odds} ')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…