![]() ![]() Like '+', all other arithmetic operators are also supported by strings.įunctions capitalize() and title() return the same result.įunctions partition() and split() work identically. Strings are immutable in Python, which means a string cannot be modified. Python does not support a character type a single character is treated as strings of length one. Strings have both positive and negative indexes. Question 10įunction split() divides a line of text into individual words. Question 9įunction index() raises an exception if the substring is not found. To get each word's first letter capitalized, title() function is used. 'ab'.isalpha() will return value as True. ![]() If a string contains letters and digits, function isalnum() will return true. ![]() The ord() returns the ASCII value of a given character. The in and not in are membership operators for strings (in, not in). Question 3įor strings, * operator performs replication. Question 2įor strings, + operator performs concatenation. Which of the following functions will raise an error if the given substring is not found in the string? Which of the following functions removes all leading and trailing spaces from a string?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |