-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path13_StringMethods.py
More file actions
61 lines (46 loc) · 1.26 KB
/
Copy path13_StringMethods.py
File metadata and controls
61 lines (46 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Strings are immutable
a = "!!!!!!Divyanshu!! !! !! Divyanshu"
print(len(a))
print(a)
print(a.lower())
print(a.upper())
print(a.rstrip("!"))
print(a.replace("Divyanshu", "Vashishth"))
print(a.split(" "))
blogHeading = "introduction tO jS"
print(blogHeading.capitalize())
str1 = "Welcome to the Console!!!"
print(str1.center(50))
print(len(str1))
print(len(str1.center(50)))
print(a.count("Divyanshu"))
str2 = "Welcome to the Console !!!"
print(str2.endswith("!!!"))
str3 = "Welcome to the Console !!!"
print(str3.endswith("to", 4, 10))
str4 = "He's name is DV. He is an Honest man."
print(str4.find("is"))
print(str4.find("ishh"))
# print(str1.index("ishh"))
str5 = "WelcomeToTheConsole"
print(str5.isalnum())
str6 = "Welcome"
print(str6.isalpha())
str7 = "hello world"
print(str7.islower())
str8 = "We wish you a Merry Christmas" # \n
print(str8.isprintable())
str9 = " " # Using Spacebar
print(str9.isspace())
str10 = " " # Using Tab
print(str10.isspace())
str11 = "World Health Organization"
print(str11.istitle())
str12 = "To Kill a Mocking Bird"
print(str12.istitle())
str13 = "Python is a Interpreted Language"
print(str13.startswith("Python"))
str14 = "Hello DV"
print(str14.swapcase())
str15 = "His name is DV. DV is an honest man."
print(str15.title())