Computer Science
Which of the following methods splits the string at the first occurrence of separator and returns a tuple containing three items?
- index()
- partition()
- split()
- count()
Python Tuples
3 Likes
Answer
partition()
Reason — The partition()
method splits the string at the first occurrence of the specified separator and returns a tuple containing three elements: the part before the separator, the separator itself, and the part after the separator.
Answered By
1 Like
Related Questions
…………… is a network security system, either hardware-based or software-based, that controls the incoming and outgoing network traffic based on a set of rules.
- Firewall
- Antivirus Software
- VMware
- Adware
Kritika wants to divide a number and store the result without decimal places into an integer variable. Suggest an appropriate operator from the following:
- /
- %
- //
- Both (a) and (b)
Find the output of the following:
for i in range(20, 30, 2): print (i)
- 1.
21 22 23 24 25
- 2.
21 23 25 27 29
3. SyntaxError
4.20 22 24 26 28
Which of the following functions will return the first three characters of a string named 's'?
- s[3:]
- s[:3]
- s[-3:]
- s[:-3]