What Does The Lower Method Do in Python
What Does The Lower Method Do in Python
Which method can be used to capitalize the first character of each word in a string?
a) upper()
b) title()
c) capitalize()
d) swapcase()
Which method is used to split a string into a list of substrings based on a specified delimiter?
a) split()
b) join()
c) replace()
d) index()
Which method returns the index of the first occurrence of a substring in a string?
a) find()
b) index()
c) count()
d) capitalize()
What does the isalnum() method return for a string containing only alphanumeric characters?
a) True
b) False
c) None
d) Error
Which method can be used to replace occurrences of a substring in a string with another
substring?
a) replace()
b) split()
c) find()
d) index()
What does the splitlines() method do?
a) Splits the string into lines based on newline characters.
b) Splits the string into lines based on whitespace.
c) Splits the string into words based on whitespace.
d) Splits the string into characters.
Which loop construct in Python is typically used for iterating over characters in a string?
a) for loop
b) while loop
c) do-while loop
d) foreach loop
What is the index of the first occurrence of "world" in the string "Hello world"?
a) 0
b) 1
c) 5
d) 6