+ 1
What does i[b] % [/b]2 == 0 mean, when i is an integer from a range?
I saw this expression as a part of challenge: https://code.sololearn.com/cbuD0LFnE6LQ/#py Moreover, I always get a syntax error
2 odpowiedzi
+ 1
Lst = []
for i in range(12):
if i % 2 == 0:
Lst.append(i)
continue
print(Lst)
this prints all even numbers... not sure about the 'b' variable. So this takes each number, from 1-11 and divides them by 2. If their remainder is 0, that number is added to the 'Lst' list. Then 'Lst' is printed to the screen.
+ 1
Thank you Steven, I was specially interested in the terms [b] and [/b]. In the meantime I think, that this was just some kind of formatting error in the presentation of the challenge task. But it looked "pythonic" ;-)