Q. Consider the following string mySubject:
mySubject = "Computer Science"
What will be the output of the following string operations :
i. print(mySubject[0:len(mySubject)])
ii. print(mySubject[-7:-1])
iii. print(mySubject[::2])
iv. print(mySubject[len(mySubject)-1])
v. print(2*mySubject)
vi. print(mySubject[::-2])
vii. print(mySubject[:3] + mySubject[3:])
viii. print(mySubject.swapcase())
ix. print(mySubject.startswith('Comp'))
x. print(mySubject.isalpha())
Answer :-
I = Computer Science
II = Scienc
III = Cmue cec
IV = e
V = Computer ScienceComputer Science
VI = eniSrtpo
VII = Computer Science
VIII = cOMPUTER sCIENCE
IX = True
X = False
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )