Computer Science

Find the error in the following list comprehension :

["good" if i < 3: else: "better" for i in range(6)]

Linear Lists

3 Likes

Answer

The code contains a syntax error due to the placement of the colon (:). There should not be colon in list comprehension.

Answered By

2 Likes


Related Questions