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']
>>>

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. 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?

    ReplyDelete
    Replies
    1. Script is correct. I did not understand what you want to say.

      Delete
    2. using partition function (syntax:
      str.partition(separator)
      here the result will be in tuple format with three elements in it.

      Delete
  2. i think we do not need to write split function bcz they are asking partition only that's why he was asking about it

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post