Major edits.
authorSantosh G. Vattam <vattam.santosh@gmail.com>
Tue, 27 Apr 2010 12:14:30 +0530
changeset 386 a0bec380b44f
parent 385 c70118cdde66
child 387 5e485a5d8ac4
Major edits.
day1/exercise/collatz.py
day1/exercise/datestring.py
day1/exercise/duplicate_marks.py
--- a/day1/exercise/collatz.py	Fri Apr 23 08:49:25 2010 +0530
+++ b/day1/exercise/collatz.py	Tue Apr 27 12:14:30 2010 +0530
@@ -1,10 +1,8 @@
 a = int( raw_input( 'Enter number: ') )
 while a != 4:
-    print a
+    print a,
     if a % 2 == 1:
         a = a * 3 + 1
     else:
         a /= 2
-print 4
-print 2
-print 1
+print 4, 2, 1
--- a/day1/exercise/datestring.py	Fri Apr 23 08:49:25 2010 +0530
+++ b/day1/exercise/datestring.py	Tue Apr 27 12:14:30 2010 +0530
@@ -1,6 +1,5 @@
-month2mm = { 'JAN': 1, 'FEB': 2, 'MAR': 3, 'APR': 4, 'MAY': 5,
-'JUN': 6, 'JUL': 7, 'AUG': 8, 'SEP': 9, 'OCT': 10, 'NOV': 11,
-'DEC': 12 }
+month2mm = { 'JAN': 1, 'FEB': 2, 'MAR': 3, 'APR': 4, 'MAY': 5, 'JUN': 6,
+'JUL': 7, 'AUG': 8, 'SEP': 9, 'OCT': 10, 'NOV': 11, 'DEC': 12 }
 
 COMMA = ','
 SPACE = ' '
--- a/day1/exercise/duplicate_marks.py	Fri Apr 23 08:49:25 2010 +0530
+++ b/day1/exercise/duplicate_marks.py	Tue Apr 27 12:14:30 2010 +0530
@@ -1,13 +1,18 @@
 students = {
-    'Madhu': 12,
+    'Madhu': 45,
     'Shantanu':45,
     'Puneeth': 54,
     'Vattam': 35,
-    'KD': 50,
+    'KD': 54,
+    'Asokan': 45
     }
 
 all_marks = students.values()
 unique_marks = set(all_marks)
 
 print "Number of Duplicate marks: ", len(all_marks) - len(unique_marks)
-print "Duplicate marks: ", set(all_marks - list(unique_marks))
+
+for i in unique_marks:
+    all_marks.remove(i)
+
+print "Duplicate marks:", set(all_marks)