adplus-dvertising
frame-decoration

Question

What is the output of the code shown?
s=["pune", "mumbai", "delhi"]
[(w.upper(), len(w)) for w in s]

a.

Error

b.

[‘PUNE’, 4, ‘MUMBAI’, 6, ‘DELHI’, 5]

c.

[PUNE, 4, MUMBAI, 6, DELHI, 5]

d.

[(‘PUNE’, 4), (‘MUMBAI’, 6), (‘DELHI’, 5)]

Posted under Python

Answer: (d).[(‘PUNE’, 4), (‘MUMBAI’, 6), (‘DELHI’, 5)]

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 code shown?