day1/exercise/duplicate_marks.py
author Santosh G. Vattam <vattam.santosh@gmail.com>
Tue, 27 Apr 2010 12:14:30 +0530
changeset 386 a0bec380b44f
parent 64 333092b68926
permissions -rw-r--r--
Major edits.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
students = {
386
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
     2
    'Madhu': 45,
64
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
    'Shantanu':45,
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
    'Puneeth': 54,
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
    'Vattam': 35,
386
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
     6
    'KD': 54,
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
     7
    'Asokan': 45
64
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
    }
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
all_marks = students.values()
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
unique_marks = set(all_marks)
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
333092b68926 Added quiz tex file and all exercise problems Madhu worked out.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
print "Number of Duplicate marks: ", len(all_marks) - len(unique_marks)
386
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
    14
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
    15
for i in unique_marks:
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
    16
    all_marks.remove(i)
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
    17
a0bec380b44f Major edits.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 64
diff changeset
    18
print "Duplicate marks:", set(all_marks)