diff options
author | Santosh G. Vattam | 2010-04-27 12:14:30 +0530 |
---|---|---|
committer | Santosh G. Vattam | 2010-04-27 12:14:30 +0530 |
commit | 8c5dc893d695e91e5068e3719be9ead30e75d2e0 (patch) | |
tree | 06a55a2536ff72494d8b170c292e17e59777de34 /day1 | |
parent | e17f34beba1df09250d2e80d502e291aa97be3ac (diff) | |
download | workshops-8c5dc893d695e91e5068e3719be9ead30e75d2e0.tar.gz workshops-8c5dc893d695e91e5068e3719be9ead30e75d2e0.tar.bz2 workshops-8c5dc893d695e91e5068e3719be9ead30e75d2e0.zip |
Major edits.
Diffstat (limited to 'day1')
-rw-r--r-- | day1/exercise/collatz.py | 6 | ||||
-rw-r--r-- | day1/exercise/datestring.py | 5 | ||||
-rw-r--r-- | day1/exercise/duplicate_marks.py | 11 |
3 files changed, 12 insertions, 10 deletions
diff --git a/day1/exercise/collatz.py b/day1/exercise/collatz.py index 7bed967..3ace3ac 100644 --- a/day1/exercise/collatz.py +++ b/day1/exercise/collatz.py @@ -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 diff --git a/day1/exercise/datestring.py b/day1/exercise/datestring.py index 4e8cad4..5a9c50f 100644 --- a/day1/exercise/datestring.py +++ b/day1/exercise/datestring.py @@ -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 = ' ' diff --git a/day1/exercise/duplicate_marks.py b/day1/exercise/duplicate_marks.py index ce4cbca..8ad85d1 100644 --- a/day1/exercise/duplicate_marks.py +++ b/day1/exercise/duplicate_marks.py @@ -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) |