Q. Write a script to partition the string 'INSTITUTE' at the occurrence of letter ‘T’.
Answer :-
s = "INSTITUTE" word = s.split("T") print(word)
Output :-
['INS', 'I', 'U', 'E']
>>>
Answer :-
s = "INSTITUTE" word = s.split("T") print(word)
Output :-
['INS', 'I', 'U', 'E']
>>>
It's wrong answer, We have to do partition at occurence of T. Split function simply just remove T. Is there any way we could partition all occurrences of T?
ReplyDeleteScript is correct. I did not understand what you want to say.
Deleteusing partition function (syntax:
Deletestr.partition(separator)
here the result will be in tuple format with three elements in it.
i think we do not need to write split function bcz they are asking partition only that's why he was asking about it
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )