You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run into an issue, where I cannot go do 3rd test.
My code is
def is_even_and_contains_red(a_list):
if "red" in a_list:
if len(a_list) % 2 == 0:
return True
else:
return False
and error message is
tests.py:30: in test_odd_with_red
assert is_even_and_contains_red(['red', 'blue', 'green']) == False
E AssertionError: assert None == False
E + where None = is_even_and_contains_red(['red', 'blue', 'green'])
I follow it step by step, but still cannot figure out what I'm missing.
I don't mind if someone just could give me a hint. I do not need ready answer :)
The text was updated successfully, but these errors were encountered:
You have two If statements, but only one Else statement. The Else corresponds to the first If.
But there's nothing in your code to say what happens if your second if statement is False, so if len(a_list) is an odd number it's just going to spit the results of the first If statement.
I run into an issue, where I cannot go do 3rd test.
My code is
and error message is
tests.py:30: in test_odd_with_red
assert is_even_and_contains_red(['red', 'blue', 'green']) == False
E AssertionError: assert None == False
E + where None = is_even_and_contains_red(['red', 'blue', 'green'])
I follow it step by step, but still cannot figure out what I'm missing.
I don't mind if someone just could give me a hint. I do not need ready answer :)
The text was updated successfully, but these errors were encountered: