@@ -5,15 +5,40 @@ def get_immediate_subdirectories(a_dir):
5
5
return [name for name in os .listdir (a_dir )
6
6
if os .path .isdir (os .path .join (a_dir , name ))]
7
7
8
+
9
+ # Repository Directory
10
+
8
11
current_d = dirname (abspath (__file__ ))
12
+
13
+ # Platforms
9
14
Codewars = current_d + '\Codewars'
15
+ HackerRank = current_d + '\HackerRank'
16
+ Exercism = current_d + '\Exercism'
17
+ Leetcode = current_d + '\Leetcode'
18
+
19
+ # Platform Index Location
10
20
Codewars_README = os .path .normpath (Codewars + '\README.md' )
21
+ HackerRank_README = os .path .normpath (HackerRank + '\README.md' )
22
+ Exercism_README = os .path .normpath (Exercism + '\README.md' )
23
+ Leetcode_README = os .path .normpath (Leetcode + '\README.md' )
11
24
25
+ # Delete Every Platform Index before Reindexing
12
26
open (Codewars_README , 'w' ).close ()
27
+ open (HackerRank_README , 'w' ).close ()
28
+ open (Exercism_README , 'w' ).close ()
29
+ open (Leetcode_README , 'w' ).close ()
30
+
31
+ # Codewars
13
32
33
+ # for each difficulty level
14
34
for x in get_immediate_subdirectories (os .path .normpath (Codewars )):
15
- challenges = get_immediate_subdirectories (os .path .normpath (Codewars + '\\ ' + x ))
16
35
36
+ # Each difficulty README
37
+ Difficulty_README = os .path .normpath (Codewars + '\\ ' + x + '\\ README.md' )
38
+
39
+ # Each difficulty's challenges
40
+ challenges = get_immediate_subdirectories (os .path .normpath (Codewars + '\\ ' + x ))
41
+
17
42
with open (Codewars_README , "a" , encoding = "utf-8" ) as f :
18
43
f .write ("\n " )
19
44
f .write ("## " + str (x ))
@@ -28,12 +53,17 @@ def get_immediate_subdirectories(a_dir):
28
53
f .write ("\n " )
29
54
f .close ()
30
55
31
- # Add Links to Folders for Each Challenges
32
- # Test spaces between the Challenges
56
+ with open (Difficulty_README , "a" , encoding = "utf-8" ) as ff :
57
+ ff .write ("\n " )
58
+ ff .write ("- [" + str (y ) + "](https://github.com/gzachariadis/Python.Challenges/tree/main/Codewars/" + x + '/' + str (y ).replace (' ' , '%20' ) + ')' )
59
+ ff .write ("\n " )
60
+ ff .close ()
61
+
62
+
33
63
# Add invididual Indexes for Each Level
34
64
# Everything should be in Alphabetical Order
35
65
36
66
# Use Remove first and last character from string under 8-kyu as a Template for every other file.
37
67
# Find a way to create a template folder with README.md template and an empty python file each time I want to submit a new challenge.
38
- # Add a To-do Road Map to the README.md
68
+
39
69
0 commit comments