def sets1(s1,s2):
x=s1.intersection(s2)
print("Common letters in s1 and s2",x)
y=s1.difference(s2)
print("Letters present in s1 but not in s2",y)
a=s2.difference(s1)
print("Letters present in s2 but not in s1",a)
b=s1.symmetric_difference(s2)
print("Symmetric difference between s1 and s2",b)
s1=set("salem")
s2=set("sonacollege")
sets1(s1,s2)
def pangram(st):
a=set('abcdefghijklmnopqrstuvwxyz')
st=set(st.lower())
if(len((a)-(st))==0):
print("Pangram")
else:
print("Not a Pangram")
st=input("Enter the string to check pangram: ")
pangram(st)
def vowel_count(st):
vcount=0
ccount=0
vowel = set("aeiouAEIOU")
for i in st:
if i in vowel:
vcount+=1
elif((i>='a' and i<='z') or (i>='A' and i<='Z')):
ccount+=1
print("Vowel Count=",vcount)
print("Consonent Count=", ccount)
st=input("Enter the string: ")
vowel_count(st)
Comments
Post a Comment