diff --git a/arithmetic_arranger.py b/arithmetic_arranger.py index 6f59604..c77bcaa 100644 --- a/arithmetic_arranger.py +++ b/arithmetic_arranger.py @@ -6,9 +6,10 @@ def arithmetic_arranger(problems, val=False): # list of all operations in str format operations = list(map(lambda x: x.split()[1], problems)) - if set(operations) != {'+', '-'} and len(set(operations)) != 2: - arranged_problems = "Error: Operator must be '+' or '-'." - return arranged_problems + for opt in operations: + if opt not in {'+', '-'}: + arranged_problems = "Error: Operator must be '+' or '-'." + return arranged_problems numbers = [] # list of all operands in str format for i in problems: