Advertisements
Advertisements
प्रश्न
What is the output of the expression?
country='International'
print(country.split("n"))पर्याय
('I', 'ter', 'atio', 'al')
['I', 'ter', 'atio', 'al']
['I', 'n', 'ter', 'n', 'atio', 'n', 'al']
Error
MCQ
Advertisements
उत्तर
['I', 'ter', 'atio', 'al']
Explanation:
- The split() method in Python divides a text into a list of substrings using the separator specified. The separator is "n"; hence, any occurrence of the letter "n" will be used to separate the string.
- 'International' split by
"n"becomes:'I''ter''atio''al'
- Thus, the result is:
['I', 'ter', 'atio', 'al']
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
