From ee0f4a4b8af1a64cf29ab356f0722d97249dc71f Mon Sep 17 00:00:00 2001 From: Jerry Kim Date: Tue, 19 Jan 2021 18:03:30 +0900 Subject: [PATCH 1/7] Setting up GitHub Classroom Feedback From 89ff000abe22ebb48068a14cbb08268fde6e7986 Mon Sep 17 00:00:00 2001 From: Huicheol Moon Date: Tue, 19 Jan 2021 18:30:19 +0900 Subject: [PATCH 2/7] Update my code --- text_processing2.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/text_processing2.py b/text_processing2.py index 470950c..8bdfe9e 100644 --- a/text_processing2.py +++ b/text_processing2.py @@ -28,7 +28,14 @@ def digits_to_words(input_string): >>> tp2.digits_to_words(digits_str2) 'three one four one five' """ - digit_string = None + digit_string = "" + digit_table = {"1": "one", "2": "two", "3": "three", "4": "four", "5": "five", "6": "six", "7": "seven", "8": "eight", "9": "nine", "0": "zero"} + + for string in input_string : + if string.isdigit(): + digit_string += digit_table[string] + " " + digit_string = digit_string[:-1] + return digit_string @@ -64,5 +71,14 @@ def to_camel_case(underscore_str): >>> tp2.to_camel_case(underscore_str3) "alreadyCamel" """ - camelcase_str = None + camelcase_str = "" + no_undersocre_strings = underscore_str.split("_") + + for order, string in enumerate(no_undersocre_strings): + if order == 0: + string = string.lower() + else: + string = string[0].upper() + string[1:].lower() + camelcase_str += string + return camelcase_str From 438a02aed88ea2fa79cf3084cf5f51490be2ddf4 Mon Sep 17 00:00:00 2001 From: Huicheol Moon Date: Tue, 19 Jan 2021 18:44:33 +0900 Subject: [PATCH 3/7] Update my code --- text_processing2.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/text_processing2.py b/text_processing2.py index 8bdfe9e..4993dae 100644 --- a/text_processing2.py +++ b/text_processing2.py @@ -72,13 +72,16 @@ def to_camel_case(underscore_str): "alreadyCamel" """ camelcase_str = "" + underscore_str = underscore_str.strip("_") + underscore_str = underscore_str.lower() no_undersocre_strings = underscore_str.split("_") - for order, string in enumerate(no_undersocre_strings): - if order == 0: - string = string.lower() - else: - string = string[0].upper() + string[1:].lower() - camelcase_str += string - - return camelcase_str + if no_undersocre_strings != "": + for i, word in enumerate(no_undersocre_strings): + if word != "": + for j, string in enumerate(word): + if i !=0 and j == 0: + string = string.upper() + camelcase_str += string + + return camelcase_str \ No newline at end of file From 8586677bf5a8787b4874ea4838629289ab05001a Mon Sep 17 00:00:00 2001 From: Huicheol Moon Date: Tue, 19 Jan 2021 18:52:30 +0900 Subject: [PATCH 4/7] Update my code for testing --- text_processing2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/text_processing2.py b/text_processing2.py index 4993dae..87b7d34 100644 --- a/text_processing2.py +++ b/text_processing2.py @@ -73,7 +73,6 @@ def to_camel_case(underscore_str): """ camelcase_str = "" underscore_str = underscore_str.strip("_") - underscore_str = underscore_str.lower() no_undersocre_strings = underscore_str.split("_") if no_undersocre_strings != "": @@ -82,6 +81,10 @@ def to_camel_case(underscore_str): for j, string in enumerate(word): if i !=0 and j == 0: string = string.upper() + elif i !=0 and j != 0: + string = string.lower() camelcase_str += string - - return camelcase_str \ No newline at end of file + + return camelcase_str + +print(to_camel_case("alreadyCamel")) \ No newline at end of file From fd919809c19be0787c35c29a8f5ea90eee7e803b Mon Sep 17 00:00:00 2001 From: Huicheol Moon Date: Tue, 19 Jan 2021 18:55:49 +0900 Subject: [PATCH 5/7] Update my code --- text_processing2.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/text_processing2.py b/text_processing2.py index 87b7d34..b5fdd88 100644 --- a/text_processing2.py +++ b/text_processing2.py @@ -73,6 +73,7 @@ def to_camel_case(underscore_str): """ camelcase_str = "" underscore_str = underscore_str.strip("_") + underscore_str = underscore_str.lower() no_undersocre_strings = underscore_str.split("_") if no_undersocre_strings != "": @@ -81,10 +82,6 @@ def to_camel_case(underscore_str): for j, string in enumerate(word): if i !=0 and j == 0: string = string.upper() - elif i !=0 and j != 0: - string = string.lower() camelcase_str += string - + return camelcase_str - -print(to_camel_case("alreadyCamel")) \ No newline at end of file From 4eb883b0f002fa0a1daa541a16b12bce9367990f Mon Sep 17 00:00:00 2001 From: Huicheol Moon Date: Tue, 19 Jan 2021 18:59:22 +0900 Subject: [PATCH 6/7] Update my code --- text_processing2.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/text_processing2.py b/text_processing2.py index b5fdd88..bd89ec6 100644 --- a/text_processing2.py +++ b/text_processing2.py @@ -73,15 +73,20 @@ def to_camel_case(underscore_str): """ camelcase_str = "" underscore_str = underscore_str.strip("_") - underscore_str = underscore_str.lower() - no_undersocre_strings = underscore_str.split("_") - - if no_undersocre_strings != "": - for i, word in enumerate(no_undersocre_strings): - if word != "": - for j, string in enumerate(word): - if i !=0 and j == 0: - string = string.upper() - camelcase_str += string + + if underscore_str.count("_") > 0 : + underscore_str = underscore_str.lower() + no_undersocre_strings = underscore_str.split("_") + + if no_undersocre_strings != "": + for i, word in enumerate(no_undersocre_strings): + if word != "": + for j, string in enumerate(word): + if i !=0 and j == 0: + string = string.upper() + camelcase_str += string + + else: + camelcase_str = underscore_str return camelcase_str From 19dac9eb2a42a5c08753cf9d82227abff3beaf01 Mon Sep 17 00:00:00 2001 From: Huicheol Moon Date: Wed, 3 Nov 2021 06:21:30 +0900 Subject: [PATCH 7/7] Update text_processing2.py --- text_processing2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text_processing2.py b/text_processing2.py index bd89ec6..c0f6e9d 100644 --- a/text_processing2.py +++ b/text_processing2.py @@ -1,5 +1,5 @@ ####################### -# Test Processing II # +# Test Processing II #11 #######################