adplus-dvertising
frame-decoration

Question

What is the output of the following?
print([if i%2==0: i; else: i+1; for i in range(4)])

a.

[0, 2, 2, 4].

b.

[1, 1, 3, 3].

c.

error

d.

none of the mentioned

Posted under Python

Answer: (c).error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following?