KnowledgeBoat Logo

Computer Science

For a given declaration in Python as s = "WELCOME", which of the following will be the correct output of print(s[1::2])?

  1. WEL
  2. COME
  3. WLOE
  4. ECM

Python Funda

8 Likes

Answer

ECM

Reason — The slicing will start from index 1 and return at every alternative step.

s[1] = E
s[3] = C
s[5] = M
output = ECM

Answered By

5 Likes


Related Questions