0% found this document useful (0 votes)
5 views2 pages

String Manipulation and Analysis in Python

The document is a Python script that performs various string manipulations, including counting words starting with 's', listing and sorting vowels, counting spaces, and determining word frequency. It also checks if a given string is a palindrome and allows the user to delete a specified character from the string. The script provides outputs for each operation, demonstrating basic string handling techniques in Python.

Uploaded by

gowthamikavyasri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

String Manipulation and Analysis in Python

The document is a Python script that performs various string manipulations, including counting words starting with 's', listing and sorting vowels, counting spaces, and determining word frequency. It also checks if a given string is a palindrome and allows the user to delete a specified character from the string. The script provides outputs for each operation, demonstrating basic string handling techniques in Python.

Uploaded by

gowthamikavyasri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

srn=input("enter strin or sentence")

ls=[Link]()

print(ls)

count=0;l=[];sp=0

for i in ls:

if [Link]("s"):

count=count+1

print("count of sub string startswith s:",count)

#---------------------------------------------------

for i in srn:

if i in "aeiouAEIOU":

[Link](i)

print("list of owels in the string:",l)

[Link]()

print("sorted list",l)

#----------------------------------------------------

for i in srn:

if [Link]():

sp=sp+1

print("space count is",sp)

#---------------------------------------------------

wrdfq=[]

for wrd in ls:

[Link]([Link](wrd))

print("word frequence list",wrdfq)


print("pairing of word and frequence",list(zip(ls,wrdfq)))

#-------------------------------------------------------

print("string reverse order")

st=input("enter string")

for i in range(-1,-len(st)-1,-1):

print(st[i],end='')

print()

if st==st[::-1]:

print("given string is palindrome")

else:

print("given string is not palindrome")

#-----------------------------------------------------------

print("deleting a character from a string")

delc=input("enter a character for delete: ")

nst=''

for ch in st:

if ch!=delc:

nst=nst+ch

print("new string after deleting a character:\t",nst)

You might also like