Post

@PythonPr Answer: B ([0,1,2])
The code uses a list comprehension [x for x in range(3)] to create a list.
The range(3) function in Python generates a sequence of numbers starting from 0 by default, and stopping before the number 3. The sequence generated is 0, 1, and 2.
English

@PythonPr B
[0, 1, 2]
Python counts from zero and leaves out the final number.
English

@PythonPr Within the list [] argument x is declared as a variable of range 3. Since range starts at 0 the range would be 0, 1, 2 when printed () .
English

@PythonPr The correct answer is B
Explanation:
The code print([x for x in range(3)]) uses a list comprehension to generate a list of numbers from 0 up to (but not including) 3.
So range(3) produces: 0, 1, 2.
English

@PythonPr B is right answer. This is the example of list comprension, in this way you can write the python code nore elegant way..
English

@PythonPr B: [0,1,2]. Python and its range, always trolling newbies by ghosting the last number. Love that for us.
English






















