1.

To retrieve the character at index 3 from string s=”Hello” what command do we execute (multiple answers allowed)?(a) s[](b) s.getitem(3)(c) s.__getitem__(3)(d) s.getItem(3)I got this question in an international level competition.Query is from Strings topic in section Strings of Python

Answer»

The CORRECT option is (C) s.__getitem__(3)

The best explanation: __getitem(..) can be used to get character at index SPECIFIED as parameter.



Discussion

No Comment Found

Related InterviewSolutions