Quizlet Programing
capitalize()
string capitalize() in Python. In Python, the capitalize() method converts the first character of a string to capital (uppercase) letter. If the string has its first character as capital, then it returns the original string. cat_cap
upper()
Changes a string to uppercase Code: "cat".upper() Result: CAT
\n (new line escape sequence)
In Python strings, the backslash "\" is a special character, also called the "escape" character. It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a carriage return. Conversely, prefixing a special character with "\" turns it into an ordinary character. cat_\n4129624
isupper()
In Python, isupper() is a built-in method used for string handling. The isupper() methods returns "True" if all characters in the string are uppercase, Otherwise, It returns "False". This function is used to check if the argument contains any uppercase characters such as : ABCDEFGHIJKLMNOPQRSTUVWXYZ. cat_isupper
islower()
In Python, lower() is a built-in method used for string handling. The lower() methods returns the lowercase string from the given string. It converts all uppercase characters to lowercase. cat_islower
title()
Python String Title method. Title function in python is the Python String Method which is used to convert the first character in each word to Uppercase and remaining characters to Lowercase in string and returns new string. Syntax: str.Title() parameters:str is a valid string which we need to convert. cat_title
isalpha()
Python String isalpha() and its application. In Python, isalpha() is a built-in method used for string handling. The isalpha() methods returns "True" if all characters in the string are alphabets, Otherwise, It returns "False". cat_isalpha
isdigit()
Python String isdigit() and its application. In Python, isdigit() is a built-in method used for string handling. The isdigit() methods returns "True" if all characters in the string are digits, Otherwise, It returns "False". ... 2.False- If the string contains 1 or more non-digits. cat_isdigit
replace()
Replaces one string with another Code: "cat".replace("t","b") Result: cab
\t (tab escape sequence)
Tabs a string in the program output Code: print("\t","cat") Result: cat
isalnum()
Tests whether a string is all alphanumeric Code: "cat5".isalnum() Result: True