diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-05-23 21:35:05 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-05-23 21:35:05 +0100 |
| commit | ce4a97e1eef2b94c4f06adcf83e3c29965f00a07 (patch) | |
| tree | a08a3f2a7c76088af4415e2350507f73e23c6718 /challenge-166/eric-cheung/python/ch-2.py | |
| parent | a8857048c1a6c24c68cf413fabf780f606061bd7 (diff) | |
| download | perlweeklychallenge-club-ce4a97e1eef2b94c4f06adcf83e3c29965f00a07.tar.gz perlweeklychallenge-club-ce4a97e1eef2b94c4f06adcf83e3c29965f00a07.tar.bz2 perlweeklychallenge-club-ce4a97e1eef2b94c4f06adcf83e3c29965f00a07.zip | |
- Added guest solutions by Eric Cheung.
Diffstat (limited to 'challenge-166/eric-cheung/python/ch-2.py')
| -rwxr-xr-x | challenge-166/eric-cheung/python/ch-2.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/challenge-166/eric-cheung/python/ch-2.py b/challenge-166/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..83b9449b5d --- /dev/null +++ b/challenge-166/eric-cheung/python/ch-2.py @@ -0,0 +1,51 @@ +
+## Remarks
+## https://www.geeksforgeeks.org/python-union-two-lists/
+
+arrFile_Dir_A = ["Arial.ttf", "Comic_Sans.ttf", "Georgia.ttf", "Helvetica.ttf", "Impact.otf", "Verdana.ttf", "Old_Font/"]
+arrFile_Dir_B = ["Arial.ttf", "Comic_Sans.ttf", "Courier_New.ttf", "Helvetica.ttf", "Impact.otf", "Tahoma.ttf", "Verdana.ttf"]
+arrFile_Dir_C = ["Arial.ttf", "Courier_New.ttf", "Helvetica.ttf", "Impact.otf", "Monaco.ttf", "Verdana.ttf"]
+
+arrFile_Union = sorted(list(set().union(arrFile_Dir_A, arrFile_Dir_B, arrFile_Dir_C)))
+
+## print (arrFile_Union)
+
+print ("dir_a\t\tdir_b\t\tdir_c")
+
+for elemLoop in arrFile_Union:
+
+ strResult = ""
+ elemOrigLoop = elemLoop
+ elemLoop = elemLoop.replace("/", "")
+ ## print (elemLoop)
+
+ nCount_Dir_A = arrFile_Dir_A.count(elemOrigLoop) + arrFile_Dir_A.count(elemLoop)
+ nCount_Dir_B = arrFile_Dir_B.count(elemOrigLoop) + arrFile_Dir_B.count(elemLoop)
+ nCount_Dir_C = arrFile_Dir_C.count(elemOrigLoop) + arrFile_Dir_C.count(elemLoop)
+ ## print (nCount_Dir_A)
+ ## print (nCount_Dir_B)
+ ## print (nCount_Dir_C)
+
+ if nCount_Dir_A > 0 and nCount_Dir_B > 0 and nCount_Dir_C > 0:
+ continue
+
+ if nCount_Dir_A > 0:
+ strResult = strResult + elemOrigLoop
+ else:
+ strResult = strResult + "\t"
+
+ strResult = strResult + "\t"
+
+ if nCount_Dir_B > 0:
+ strResult = strResult + elemOrigLoop
+ else:
+ strResult = strResult + "\t"
+
+ strResult = strResult + "\t"
+
+ if nCount_Dir_C > 0:
+ strResult = strResult + elemOrigLoop
+ else:
+ strResult = strResult + "\t"
+
+ print (strResult)
|
