Advertisements
Advertisements
Question
What is the output of the given Python code?
st='Waterskiing is thrilling!'
print(st.split("i"))Options
['Watersk', 'ng ', 's thr', 'll', ‘ng!']['Watersk', '', 'ng ', 's thr', 'll', 'ng!']['Watersk', 'i', 'ng ', 's thr', 'll', ‘ng!']Error
MCQ
Advertisements
Solution
['Watersk', '', 'ng ', 's thr', 'll', 'ng!']
Explanation:
The split("i") function divides the string wherever 'i' occurs.
Two 'i's in “skiing” create an empty string '' between them, giving.
shaalaa.com
Is there an error in this question or solution?
