Untitled4.ipynb - String
Untitled4.ipynb - String
print(len(a))
13
He is good man
a = "harry"
print(a.replace(a,"Code with kartikay kumar"))
a = "kartikay kumar"
print(a.replace("a","h"))
Khrtikhy kumhy
he is good man
a = "1 2 3 4 5 6 7 "
print(a.center(10))
1 2 3 4 5 6 7
str1 = "hello"
str2 = "kartikay kumar"
result = str1 + " "+ str2
print(result)
ay kumar!
text = "rahul"
reversed_text = text[::-1]
print(reversed_text)
luhar
a = "hello,elina!"
words = a.split()
print(words)
['hello,elina!']
str1 = "hello"
str2 = "rahul"
if str1 == str2:
print("string are equal.")
else:
print("sting are not equal.")
text = "python"
reversed_text = ''.join(reversed(text))
print(reversed_text)
nohtyp
text = "hello,world!"
swapped_text = text.swapcase()
print(swapped_text)
HELLO,WORLD!