From 0e5da5a08105ac626778f40f9e65001106e13696 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Thu, 11 Apr 2024 03:42:33 +0530 Subject: [PATCH 1/5] hello World #1 --- practice/hello-world/hello_world.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/practice/hello-world/hello_world.py b/practice/hello-world/hello_world.py index adaa6c2..d695ea1 100644 --- a/practice/hello-world/hello_world.py +++ b/practice/hello-world/hello_world.py @@ -1,2 +1,2 @@ def hello(): - return 'Goodbye, Mars!' + return 'Hello, World!' From 95931877024fdd8519820db0b0e83f9b8c16a9e0 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Thu, 11 Apr 2024 23:48:39 +0530 Subject: [PATCH 2/5] Revert "hello World #1" This reverts commit 0e5da5a08105ac626778f40f9e65001106e13696. --- practice/hello-world/hello_world.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/practice/hello-world/hello_world.py b/practice/hello-world/hello_world.py index d695ea1..adaa6c2 100644 --- a/practice/hello-world/hello_world.py +++ b/practice/hello-world/hello_world.py @@ -1,2 +1,2 @@ def hello(): - return 'Hello, World!' + return 'Goodbye, Mars!' From 3c151a25a1f11347fe7a4067bafc331016c565bf Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Fri, 12 Apr 2024 00:10:47 +0530 Subject: [PATCH 3/5] isogram --- .../isogram.cpython-39-pytest-6.2.4.pyc | Bin 0 -> 453 bytes .../isogram/__pycache__/isogram.cpython-39.pyc | Bin 0 -> 331 bytes .../isogram_test.cpython-39-pytest-6.2.4.pyc | Bin 0 -> 3631 bytes practice/isogram/isogram.py | 3 +++ 4 files changed, 3 insertions(+) create mode 100644 practice/isogram/__pycache__/isogram.cpython-39-pytest-6.2.4.pyc create mode 100644 practice/isogram/__pycache__/isogram.cpython-39.pyc create mode 100644 practice/isogram/__pycache__/isogram_test.cpython-39-pytest-6.2.4.pyc diff --git a/practice/isogram/__pycache__/isogram.cpython-39-pytest-6.2.4.pyc b/practice/isogram/__pycache__/isogram.cpython-39-pytest-6.2.4.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34563770d0f2cc7c188b09f1d858d33e0e24643d GIT binary patch literal 453 zcmYk1J4*vW5XX1-E)VnQW0y)e(5tLOBoON~0gL0{xZI9$@m}m~hyktQ2Qj5zX&VbG zYdb4v&locB|Nod_cOL0**kcs^aCHAc{B+522uda-JR_4#@|;Dyp(s4TI4k_9#hDb+ zdu35u@;M9qFM7*n8F$!+>*JHABs?cG?2St<#ZC~thGNHFxbdF(mfZM`TmC3q$C>39 zmRUXyTDDz3=oG3wsng=0VZE_Eg~`6`4ncPb<0Gzz#Gqrli~7dY&wzxZT+rQ|RqC%3F{&St@iH<*EyQ^=JOT-rzK%UEMp z7_zP5ox82vN~YRTY~fWzxfUDts1i5gF};;dNL&z*7~~n9cx6>$f?s_cO*sGn literal 0 HcmV?d00001 diff --git a/practice/isogram/__pycache__/isogram_test.cpython-39-pytest-6.2.4.pyc b/practice/isogram/__pycache__/isogram_test.cpython-39-pytest-6.2.4.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35984449bb762439e712cdc9a699da3d83c93184 GIT binary patch literal 3631 zcmbuC-EP}96vrihDz@|0q)oH6ThO)Wg3Z~2?V=sFAwjYY9k5_Pf?XH^2u6pt*-;-O z={Yib*FMO0nRnQe=yq3ogEens`_D27&re*zY zD%qokl|4MwAr@ePEv%lM*os%JShnTWdUZSfr_pQRKNZpRoStJ_KUh$O+A9lctnqx| zWwqA=``Fs9|AReQN85JX;)-w;3?%hjb1!>Tu(F4zdVvK?#_UzVhRQ3eS55ov)u0Xy ztk|n1!urF~HrOvw=${qi7VMyU6k8`3 zmDr(5F{z&^Y2YsGxTcusUs!ShtN%Vd{Oa_Ve&gSc-34G=7l;UN=xn!7L6b?ie*pkXVmZHo-D`HoJu*7bsR%t;G`4@iZl@w zf0_(6eU6N|9+JQp5fQf1sz??F(##$62ZF2NY!%wf zQ10d^=d~_};p|UcTrh>ZZ%pBJ(MPyXJbrEh65p+R8Io^uBv-LGzo(K^CUEvKa0;mQ z|2I{-cqD5_pG&1b%uxRHPLyxJn~zIC|5 zQ!xufkGte*lJJQk^B-hjpXOk1+DkdG_1D2tvbj_Hnx-q9Yh$h-2;3RaVknR^5-jwa*4BKb9nJjKwPW{Gr9v9Kpk0XDu zb?gquRO-pELD(++M@3$MP+03GIHY0mO-U57{8tFc4U z&?Rw;5HEm{V1&dSLVg=jkpwl7Z5&vdj9D(3V%ZcXA(gA9xMd2H+DVh(%iE?f*^t~Y z#a&aFv?0xWO(uVp1IsE_J9sLy9XqyDecLa2a=RTnXCp2&_f_243nOw_+azIR{JN8V zLh!)f!97ND&Ekd2TXA!CuZ4}1X`nK8Mn2c3B8`&d(<63HuzrAPLNe}k(qrfA)LY-0 N1YentoClRo{Xe-`%)tNv literal 0 HcmV?d00001 diff --git a/practice/isogram/isogram.py b/practice/isogram/isogram.py index 98b31c5..984c877 100644 --- a/practice/isogram/isogram.py +++ b/practice/isogram/isogram.py @@ -1,2 +1,5 @@ +#complete this function to check if the input string is an isogram or not def is_isogram(string): + scrubbed = string.replace('-', '').replace(' ', '').lower() + return len(scrubbed) == len(set(scrubbed)) pass From c33c81b0acc18405f95adb40d972e0eaa872f3db Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Mon, 22 Apr 2024 02:55:12 +0530 Subject: [PATCH 4/5] removed cache files --- .../isogram.cpython-39-pytest-6.2.4.pyc | Bin 453 -> 0 bytes .../isogram/__pycache__/isogram.cpython-39.pyc | Bin 331 -> 0 bytes .../isogram_test.cpython-39-pytest-6.2.4.pyc | Bin 3631 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 practice/isogram/__pycache__/isogram.cpython-39-pytest-6.2.4.pyc delete mode 100644 practice/isogram/__pycache__/isogram.cpython-39.pyc delete mode 100644 practice/isogram/__pycache__/isogram_test.cpython-39-pytest-6.2.4.pyc diff --git a/practice/isogram/__pycache__/isogram.cpython-39-pytest-6.2.4.pyc b/practice/isogram/__pycache__/isogram.cpython-39-pytest-6.2.4.pyc deleted file mode 100644 index 34563770d0f2cc7c188b09f1d858d33e0e24643d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 453 zcmYk1J4*vW5XX1-E)VnQW0y)e(5tLOBoON~0gL0{xZI9$@m}m~hyktQ2Qj5zX&VbG zYdb4v&locB|Nod_cOL0**kcs^aCHAc{B+522uda-JR_4#@|;Dyp(s4TI4k_9#hDb+ zdu35u@;M9qFM7*n8F$!+>*JHABs?cG?2St<#ZC~thGNHFxbdF(mfZM`TmC3q$C>39 zmRUXyTDDz3=oG3wsng=0VZE_Eg~`6`4ncPb<0Gzz#Gqrli~7dY&wzxZT+rQ|RqC%3F{&St@iH<*EyQ^=JOT-rzK%UEMp z7_zP5ox82vN~YRTY~fWzxfUDts1i5gF};;dNL&z*7~~n9cx6>$f?s_cO*sGn diff --git a/practice/isogram/__pycache__/isogram_test.cpython-39-pytest-6.2.4.pyc b/practice/isogram/__pycache__/isogram_test.cpython-39-pytest-6.2.4.pyc deleted file mode 100644 index 35984449bb762439e712cdc9a699da3d83c93184..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3631 zcmbuC-EP}96vrihDz@|0q)oH6ThO)Wg3Z~2?V=sFAwjYY9k5_Pf?XH^2u6pt*-;-O z={Yib*FMO0nRnQe=yq3ogEens`_D27&re*zY zD%qokl|4MwAr@ePEv%lM*os%JShnTWdUZSfr_pQRKNZpRoStJ_KUh$O+A9lctnqx| zWwqA=``Fs9|AReQN85JX;)-w;3?%hjb1!>Tu(F4zdVvK?#_UzVhRQ3eS55ov)u0Xy ztk|n1!urF~HrOvw=${qi7VMyU6k8`3 zmDr(5F{z&^Y2YsGxTcusUs!ShtN%Vd{Oa_Ve&gSc-34G=7l;UN=xn!7L6b?ie*pkXVmZHo-D`HoJu*7bsR%t;G`4@iZl@w zf0_(6eU6N|9+JQp5fQf1sz??F(##$62ZF2NY!%wf zQ10d^=d~_};p|UcTrh>ZZ%pBJ(MPyXJbrEh65p+R8Io^uBv-LGzo(K^CUEvKa0;mQ z|2I{-cqD5_pG&1b%uxRHPLyxJn~zIC|5 zQ!xufkGte*lJJQk^B-hjpXOk1+DkdG_1D2tvbj_Hnx-q9Yh$h-2;3RaVknR^5-jwa*4BKb9nJjKwPW{Gr9v9Kpk0XDu zb?gquRO-pELD(++M@3$MP+03GIHY0mO-U57{8tFc4U z&?Rw;5HEm{V1&dSLVg=jkpwl7Z5&vdj9D(3V%ZcXA(gA9xMd2H+DVh(%iE?f*^t~Y z#a&aFv?0xWO(uVp1IsE_J9sLy9XqyDecLa2a=RTnXCp2&_f_243nOw_+azIR{JN8V zLh!)f!97ND&Ekd2TXA!CuZ4}1X`nK8Mn2c3B8`&d(<63HuzrAPLNe}k(qrfA)LY-0 N1YentoClRo{Xe-`%)tNv From 4b90bd1790eb6a10823d45d7775653f3f620dbe0 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Mon, 22 Apr 2024 14:23:27 +0530 Subject: [PATCH 5/5] improved the code --- practice/isogram/isogram.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/practice/isogram/isogram.py b/practice/isogram/isogram.py index 984c877..157020e 100644 --- a/practice/isogram/isogram.py +++ b/practice/isogram/isogram.py @@ -1,5 +1,26 @@ -#complete this function to check if the input string is an isogram or not def is_isogram(string): + """ + Check if the input string is an isogram. + + An isogram (also known as a "nonpattern word") is a word or phrase + without a repeating letter, however spaces and hyphens are allowed + to appear multiple times. + + Args: + string (str): The string to check. + + Returns: + bool: True if the string is an isogram, False otherwise. + + Examples: + >>> is_isogram("subdermatoglyphic") + True + >>> is_isogram("Alphabet") + False + """ + # Remove hyphens and spaces, and convert to lowercase scrubbed = string.replace('-', '').replace(' ', '').lower() - return len(scrubbed) == len(set(scrubbed)) - pass + + # An isogram has no repeating letters, so the length of the string + # should be equal to the number of unique letters (the size of the set) + return len(scrubbed) == len(set(scrubbed)) \ No newline at end of file