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)

d={1:"st1",2:"st2",3:"st3",4:"st4"}
b={5:"st5"}
def dictionary(d,b):
    d.update(b)
    print(d)
    print(d.copy())
    d.pop(4)
    print(d)
    print(d.keys())
    print(d.items())
    print(d.clear)

print(dictionary(d,b))
def max_visited_speciality(patient_medical_speciality_list,medical_speciality):
    cP,cO,cE=0,0,0
    for i in patient_medical_speciality_list:
        if 'P'==i:
            cP+=1
        elif 'E'==i:
            cE+=1
        elif 'O'==i:
            cO+=1

    if cP>cO and cP>cE:
        return medical_speciality['P']
    elif(cO>cE):
        return medical_speciality['O']
    else:
        return medical_speciality['E']
patient_medical_speciality_list=[301,'P',302, 'P' ,305, 'P' ,401, 'E' ,656, 'E']
medical_speciality={"P":"Pediatrics","O":"Orthopedics","E":"ENT"}
speciality=max_visited_speciality(patient_medical_speciality_list,medical_speciality)
print(speciality)

Comments

Popular posts from this blog