0
nums = [i**2 for i in range(5)] print(nums) [1, 4, 9, 16] "..what will this create..?" "Correct" answer was: "A list of even numbers between 0 and 18." 9 is not an even number tho. Is this a typo or am i missunderstanding/missinterpreting?
3 Respostas
+ 3
Yes, but once the list is filled after the operations the list is a list of numbers again.
However, working with integers the Max number/square is 16. Don't understand why it says 18.
And other doubt... range excludes the last number (5), but it doen't includes the zero as the first iterable?
0
i*2 would be even numbers, i**2 are squares
0
nums = [i**2 for i in range(5)]
print(nums)
will give
[0,1,4,9,16]