Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code snippet?
x = [i**+1 for i in range(3)]; print(x);

What will be the output of the following Python code snippet?
x = [i**+1 for i in range(3)]; print(x);
a) [0, 1, 2]
b) [1, 2, 5]
c) error, **+ is not a valid operator
d) error, ‘;’ is not allowed

Answer: a
Explanation: i**+1 is evaluated as (i)**(+1).

Join The Discussion