a = "kartikay kumar"
print(len(a))
name ="rahul is gada"
print(len(name))
13
apple="he said ,i want to eat an apple"
print(apple)
he said ,i want to eat an apple
a = "he is good man"
print(a.capitalize())
He is good man
a = "harry"
print(a.replace(a,"Code with kartikay kumar"))
Code with kartikay kumar
a = "kartikay kumar"
print(a.replace("a","h"))
Khrtikhy kumhy
a = "HE iS GOOD MAN"
print(a.casefold())
he is good man
a = "1 2 3 4 5 6 7 "
print(a.center(10))
1 2 3 4 5 6 7
a = "he is living alone"
print(a.encode())
b'he is living alone'
str1 = "hello"
str2 = "kartikay kumar"
result = str1 + " "+ str2
print(result)
hello kartikay kumar
text = "repeat me "
repeated_text = text * 3
print(repeated_text)
repeat me repeat me repeat me
text = "hello,kartikay kumar!"
substring = text[7:12]
print(substring)
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.")
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!
text = "hello, world!"
char_to_count = '1'
count = text.count(char_to_count)
print(f"'{char_to_count}' appears {count} times.")
'1' appears 0 times.