The below example prints all the words starting with letter 's' from the input string.
split() - This function separate the string based on space by default. if we need to split we can give the separator inside the function as argument. The result can be directly assigned to a variable and a list is created implicitly.
startswith() - this function finds the strings which start with letter specified.
Output
sample
starting
s
sentence
Comments
Post a Comment