1.
#length of string
print(len("Hello World!"))
2. #find the string
print("Hello World!".find("World"))
print("Hello World!".find("Hey"))
3. #isalnum - check alphanumeric present or not
print("Nidhyathi".isalnum())
print("Nidhyathi24".isalnum())
print("Nidhyathi#24".isalnum())
4. #isalpha - check alphabets present or not
print("Nidhyathi".isalpha())
print("Nidhyathi234".isalpha())
5. #isdigit - check digits present or not
print("241".isdigit())
print("fnc123".isdigit())
6. #replaces another word in a string
print("I am learning java".replace("java","python"))
7. #split is used to cut and make a list (seperator)
print("[Link] are you?".split("."))
print("Hey how are you doing ?".split(" "))
8. #strip removes spaces at the beginning and at the end
print(" Hello World! ".strip())
print(len(" Hello World! ".strip()))
9. #lstrip removes spaces at the beginning
print(" Hello World! ".lstrip())
print(len(" Hello World! ".lstrip()))
10. #rstrip removes spaces at the beginning
print(" Hello World! ".rstrip())
print(len(" Hello World! ".rstrip()))
11. #upper - converts to upper case
print("Hello World!".upper())
12. #lower - converts to lower case
print("Hello World!".lower())
13. #isupper - verifies if string is in upper case
print("hello world!".isupper())
print("HELLO WORLD!".isupper())
14. #islower - verifies if string is lower case
print("hello world!".islower())
print("HELLO WORLD!".islower())
15. #f string - used to insert values in a string from previous part of function
name = "Nidhyathi"
print(f"Hey, my name is {name}")
16. #format - formats the specified value(s) and insert them inside the string's
placeholder
print("Hey, my name is {name}".format(name = "Nidhyathi"))
txt = "For only {price:.2f} dollars!"
print([Link](price = 49))
#Use "<" to left-align the value:
txt = "We have {:<8} chickens."
print([Link](49))
#Use ">" to right-align the value:
txt = "We have {:>8} chickens."
print([Link](49))
#Use "^" to center-align the value:
txt = "We have {:^8} chickens."
print([Link](49))
17. #index returns position of string
print("Hello World!".index("World"))
print("Hello World!".index("Hey"))
18. #ORD returns Unicode of character
x = ord("h")
print(x) #104