I have a couple of minutes spare (waiting for a call), so I'll add something to the "even.append(x)" part of the text.
NB: Skilled coders try languages and libraries out by writing small programs to see how the work. So:
my "Test this by:" suggestion above was made with that in mind. But even that kind of thing is difficult right at the beginning.
So here's a text version that's similar to the "find even numbers" logic we're discussing.
First you'll set up a loop that steps from 1 to 11 (inclusive)like the "while" example earlier. I'll leave that part out.
Second, you select even numbers from the set of numbers numbers (1, 2, 3, ... 10,11) using "number % 2".
If the result of that is zero, it's an even number. Otherwise it's odd.
If it's even, add it to the container "even". Your test calls [] a "list", which is a common name for containers in different languages - but it doesn't mean the same thing in all languages /sigh.
assume our loop variable is "i"
So first pass:
the container named "even" is empty
i is 1
i%2 is 1 which means it's an odd number, so the container remains empty
second pass:
"even" is empty
i is 2
i%2 is 0, which means an even number, so the value of i is put into the container at the end
"even" is now [2]
third pass:
"even" is [2]
i is 3
i%2 is 1, which means an odd number so "even" isn't changed, and it's still [2]
fourth pass:
"even" is [2]
i is 4
i%2 is 0, so the value of i is appended at the end of the container
"even" is now [2, 4]
this continues the same way, so I'll step to 10 and 11.
tenth pass:
"even" is [2, 4, 6, 8]
i is 10
i%2 is 0, which is even, so the value of i is appended at the end of the container
"even" is now [2, 4, 6, 8, 10]
eleventh pass:
"even" is [2, 4, 6, 8, 10]
i is 11
i%2 is 1, so no change to container "even"
"even" is still [2, 4, 6, 8, 10]
The loop ends here, so we run print(even) to see all the even numbers between 1 and 11:
It probably prints this, or something similar:
[2, 4, 6, 8, 10]
If you printed the contents of the container each time through the loop, the first 11 lines of output would be something like:
[]
[2]
[2]
[2, 4]
[2, 4]
[2, 4, 6]
[2, 4, 6]
[2, 4, 6, 8]
[2, 4, 6, 8]
[2, 4, 6, 8, 10]
[2, 4, 6, 8, 10]
That's not so interesting if the is the 500thtime you've written a loop, but it's useful for you to do it now. I still do that kind of thing for debugging.