0% found this document useful (0 votes)
8 views8 pages

.

Uploaded by

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

.

Uploaded by

sonal200715
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

a=input("Enter a string:")

def length():

b=len(a)

return b

def words():

d=a.split()

c=0

for i in d:

c+=1

return c

def digits():

e=0

for i in a:

if i.isdigit():

e+=1

return e

def symbols():

f=0

for i in a:

if i.isalpha()or i.isdigit()or i.isspace():

pass

else:

f+=1

return f

def vowels():
g=0

for i in a:

if i in ("aeiouAEIOU"):

g+=1

return g

def rev():

h=a[::-1]

return h

def remvowels():

g=""

for i in a:

if i not in ("aeiouAEIOU"):

g+=i

return g

def eremove():

j=""

for i in a:

if i not in ('e','E'):

j+=i

return j

def eoccur():

k=0

for i in a:

if i in('e','E'):

k+=1
return k

def charascii():

for i in a:

l=print(i,"-",ord(i))

return l

def palindrome():

x="your string is a palindrome"

y="your string is not a palindrome"

if a[ : :1]==a[ : :-1]:

return x

else:

return y

print("1.Length of the string")

print("2.Number of words")

print("3.Number of digits")

print("4.Number of special symbols")

print("5.Number of vowels")

print("6.Reverse the string")

print("7.Remove all vowels")

print("8.Remove all e's")

print("9.Count occurence of e")

print("10.Display ASCII value of each element")

print("11.Check wheteher string is a palindrome or not")


while True:

m=int(input("Enter here:"))

if m==1:

print("length of the string=",length())

elif m==2:

print("number of words=",words())

elif m==3:

print("number of digits=",digits())

elif m==4:

print("Number of special symbols=",symbols())

elif m==5:

print("Number of vowels =",vowels())

elif m==6:

print("Reversed string is:",rev())

elif m==7:

print("string without vowels:",remvowels())

elif m==8:

print("String without e's:",eremove())

elif m==9:

print("e is occuring",eoccur(),"times")

elif m==10:

print("ASCII value of each element is:",charascii())

elif m==11:

print(palindrome())
else:

print("Cannot find your option in menu")

n=input("Do you want to perform again?(y/n):")

if n in('N','n'):

print("THANK YOU")

break

OUTPUT:-

Enter a string:string_project

1.Length of the string

2.Number of words

3.Number of digits

4.Number of special symbols

5.Number of vowels

6.Reverse the string

7.Remove all vowels

8.Remove all e's

9.Count occurence of e

10.Display ASCII value of each element

11.Check wheteher string is a palindrome or not

Enter here:1

length of the string= 14

Do you want to perform again?(y/n):y

Enter here:2

number of words= 1
Do you want to perform again?(y/n):y

Enter here:3

number of digits= 0

Do you want to perform again?(y/n):y

Enter here:4

Number of special symbols= 1

Do you want to perform again?(y/n):y

Enter here:5

Number of vowels = 3

Do you want to perform again?(y/n):y

Enter here:6

Reversed string is: tcejorp_gnirts

Do you want to perform again?(y/n):y

Enter here:7

string without vowels: strng_prjct

Do you want to perform again?(y/n):y

Enter here:8

String without e's: string_projct

Do you want to perform again?(y/n):y

Enter here:9

e is occuring 1 times

Do you want to perform again?(y/n):y

Enter here:10

s - 115

t - 116
r - 114

i - 105

n - 110

g - 103

_ - 95

p - 112

r - 114

o - 111

j - 106

e - 101

c - 99

t - 116

ASCII value of each element is: None

Do you want to perform again?(y/n):y

Enter here:11

your string is not a palindrome

Do you want to perform again?(y/n):y

Enter here:12

Cannot find your option in menu

Do you want to perform again?(y/n):n

THANK YOU

String project by:-

Anshika dixit

11th B

13

You might also like