From d0df43751e32bfb2f85aa24ef6e7844081eed949 Mon Sep 17 00:00:00 2001 From: snehakadham-sf Date: Wed, 13 Aug 2025 13:23:49 -0400 Subject: [PATCH 1/4] snehakadham 191 191 non-whitespace characters --- code_golf.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 code_golf.py diff --git a/code_golf.py b/code_golf.py new file mode 100644 index 0000000..0e7c3f7 --- /dev/null +++ b/code_golf.py @@ -0,0 +1,15 @@ +import sys +with open(sys.argv[1], 'r') as c: + for s in c: + s=s.strip() + p=0 + z='IVXLCDM ' + f='' + for i in s[::-1]: + j=int(i) + if j in [4,9]: + f=z[p*2]+(z[p*2+(1 if j==4 else 2)])+f + else: + f=z[p*2+1]*(j//5)+z[p*2]*(j%5)+f + p+=1 + print(f) From 53c8104a5f76274b675b52f293aaddbcde255672 Mon Sep 17 00:00:00 2001 From: snehakadham-sf Date: Wed, 13 Aug 2025 14:52:17 -0400 Subject: [PATCH 2/4] snehakadham 187 187 non-whitespace characters --- code_golf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code_golf.py b/code_golf.py index 0e7c3f7..e1cbe7d 100644 --- a/code_golf.py +++ b/code_golf.py @@ -1,15 +1,16 @@ import sys +z='IVXLCDM ' with open(sys.argv[1], 'r') as c: for s in c: - s=s.strip() + n=int(s) p=0 - z='IVXLCDM ' f='' - for i in s[::-1]: - j=int(i) + while n>0: + j=n%10 if j in [4,9]: f=z[p*2]+(z[p*2+(1 if j==4 else 2)])+f else: f=z[p*2+1]*(j//5)+z[p*2]*(j%5)+f + n//=10 p+=1 print(f) From 8c2df0e3b62094ef83f5a40feb604c7284d1b5fc Mon Sep 17 00:00:00 2001 From: snehakadham-sf Date: Wed, 13 Aug 2025 21:34:26 -0400 Subject: [PATCH 3/4] snehakadham 160 160 non-whitespace characters --- code_golf.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/code_golf.py b/code_golf.py index e1cbe7d..729fc7f 100644 --- a/code_golf.py +++ b/code_golf.py @@ -1,16 +1,12 @@ import sys z='IVXLCDM ' -with open(sys.argv[1], 'r') as c: - for s in c: - n=int(s) - p=0 - f='' - while n>0: - j=n%10 - if j in [4,9]: - f=z[p*2]+(z[p*2+(1 if j==4 else 2)])+f - else: - f=z[p*2+1]*(j//5)+z[p*2]*(j%5)+f - n//=10 - p+=1 - print(f) +for s in open(sys.argv[1]): + n=int(s) + p=0 + f='' + while n>0: + j=n%10 + f=(z[p*2]+(z[p*2+j//4]) if j in [4,9] else z[p*2+1]*(j//5)+z[p*2]*(j%5))+f + n//=10 + p+=1 + print(f) From 0b2b500fac0cd6e93c22c32e34c7f0afcefc5e3f Mon Sep 17 00:00:00 2001 From: snehakadham-sf Date: Thu, 14 Aug 2025 08:47:16 -0400 Subject: [PATCH 4/4] snehakadham 158 158 non-whitespace characters --- code_golf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_golf.py b/code_golf.py index 729fc7f..f2885dc 100644 --- a/code_golf.py +++ b/code_golf.py @@ -6,7 +6,7 @@ f='' while n>0: j=n%10 - f=(z[p*2]+(z[p*2+j//4]) if j in [4,9] else z[p*2+1]*(j//5)+z[p*2]*(j%5))+f + f=(z[p*2]+(z[p*2+j//4]) if j%5==4 else z[p*2+1]*(j//5)+z[p*2]*(j%5))+f n//=10 p+=1 print(f)