a) input(“Enter a string”) b) eval(input(“Enter a string”)) c) enter(“Enter a string”) d) eval(enter(“Enter ...
View QuestionTo check whether string s1 contains another string s2, use ________
To check whether string s1 contains another string s2, use ________ a) s1.__contains__(s2) b) ...
View QuestionTo return the length of string s what command do we execute?
a) s.__len__() b) len(s) c) size(s) d) ...
View QuestionTo retrieve the character at index 3 from string s=”Hello” what command do we execute ?
a) s[] b) s.getitem(3) c) s.__getitem__(3) d) s.getItem(3) Answer: c Explanation: ...
View Question
What will be the output of the following Python code?
print(0xA + 0xB + 0xC)
What will be the output of the following Python code? print(0xA + 0xB + 0xC) a) ...
View Question
What will be the output of the following Python code?
>>>str1=”helloworld”
>>>str1[::-1]
What will be the output of the following Python code? >>>str1="helloworld" >>>str1[::-1] a) dlrowolleh
View Question
What will be the output of the following Python statement?
>>> print(‘x\97\x98’)
What will be the output of the following Python statement? >>> print('x\97\x98') a) Error
View Question
What will be the output of the following Python statement?
>>>print(‘new’ ‘line’)
What will be the output of the following Python statement? >>>print('new' 'line') a) Error b) ...
View Question
What will be the output of the following Python code?
>>>print (r”\nhello”)
What will be the output of the following Python code? >>>print (r"\nhello") a) a new ...
View Question