+ 1

Python Challenge: Is there error in this python challenge?

x = list() for y in range(12): if y[b] % [/b]2 == 0: x.append(y) continue print(x) this is the code above from the python challenge. And i find this line of code weird " if y[b] % [/b]2 == 0:", where does the 'b' even come from? Is that an error? Shouldn't it be "if y%2 == 0:" If it is a valid code, can someone please explain to me how it works?

10th Nov 2022, 4:48 AM
Mario
Mario - avatar
1 ответ
+ 4
Hi Mario, you are correct, this is syntax error in the challenge code. I think this [b][/b] may be formatting in the challenge text, it looks like bbcode markup style. https://en.m.wikipedia.org/wiki/BBCode Indeed the correct code would be: if y % 2 == 0: You can report the challenge question from the app directly and indicate that it's a bug.
10th Nov 2022, 5:35 AM
Tibor Santa
Tibor Santa - avatar