Searching Strings in Python
startswithendswithfindindexrfindrindexcountreplaceGiven a string:
pythontxt = 'abcdef'
Check if this string starts with 'ac'.
Given a list:
pythonlst = ['12', '13', '14', '15']
Check if its elements start with '1'.
Given a number:
pythonnum = 123456
Check if there is a six at the end.
Given a string:
pythontxt = 'abcdef'
Find the index of the symbol 'c'.
Given a string:
pythontxt = 'ab1cd1ef'
Find the index of the character '1', while searching from the third to the seventh character of the string.
Given a string:
pythontxt = '123453637'
Find the index of the last match of the symbol '3'.
Given a string:
pythontxt = '2025.12.31'
Find the index of the last match of the character '2'.
Given a number:
pythonnum = 24536589
Find out how many fives are in it.
Given a list:
pythonlst = ['abc', 'cde', 'cbb', 'aeb']
Find out how many 'b' symbols are in each of its elements.
Given a string:
pythontxt = 'http1://'
Write the code to get the following result:
pythontxt = ''
Given a string:
pythontxt = 'a.bc.d.ef'
Replace all periods in it with spaces.