1 s = "hello WORLD" 2 s = "multiple WORDS IN a String"
res = s.capitalize() res = s.capitalize()
print(res) print(res)
3 s = "123hello WORLD" 4 string = "GEEKSFORGEEKS"
res = s.capitalize() print("lowercase string: ",
print(res) string.casefold())
5 string = "geeks for geeks" 6 string = "geeks for geeks"
new_string = string.center(24) new_string = string.center(24, '#')
print("After padding String print("After padding String is:",
is: ", new_string) new_string)
7 s = "hello world" 8 s = "Python is fun and Python is powerful."
res = s.count("o") print(s.count("Python"))
print(res)
9 s = "apple banana apple grape apple" 10 s = "apple banana apple grape apple"
substring = "apple" substring = "apple"
res = s.count(substring, 1, 20) res = s.count(substring, 8, 20)
print(res) print(res)
11. string = "geeksforgeeks" 12 text = "geeks for geeks."
print(string.endswith("geeks")) result = text.endswith('geeks.', 10)
print(result)
13 text = "geeks for geeks." 14 s = "Welcome to GeekforGeeks!"
result = text.endswith('geeks.', 10,16) index = s.find("GeekforGeeks")
print(result) print(index)
15