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?
names1 = [‘Amir’, ‘Bala’, ‘Charlie’]
names2 = [name.lower() for name in names1]
print(names2[2][0])

What will be the output of the following Python code?
names1 = [‘Amir’, ‘Bala’, ‘Charlie’]
names2 = [name.lower() for name in names1]
print(names2[2][0])
a) none
b) a
c) b
d) c

Answer: d
Explanation: List Comprehension are a shorthand for creating new lists.

Join The Discussion