Mastering Python for Data Science & AI

93% Complete

Question 3

Question 3

Select the correct answer below.

What does the following list comprehension do?

[x**2 for x in range(5)]

A

Creates a list of numbers from 0 to 4.

B

Creates a list containing the square of numbers from 0 to 4.

C

Creates a list with the number 5 repeated twice.

D

Throws a syntax error.