From 073967d4b4e7dc53ffc1788fceb32ebfb70b94fd Mon Sep 17 00:00:00 2001 From: CharlesLake <83225043+CharlesLake@users.noreply.github.com> Date: Tue, 28 Sep 2021 16:44:56 -0400 Subject: [PATCH 1/4] Add files via upload --- solveCharlesLake.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 solveCharlesLake.py diff --git a/solveCharlesLake.py b/solveCharlesLake.py new file mode 100644 index 000000000..8b47075c1 --- /dev/null +++ b/solveCharlesLake.py @@ -0,0 +1,25 @@ + +def encode(l): #s is the input string + + encoding = " " #ouput string for encode(l) + + i = 0 + while i < len(l): + # the number of same characters and a certain index + count = 1 + + while i + 1 < len(l) and l[i] == l[i + 1]: + count = count + 1 + i = i + 1 + + # record the ammount of times a character is used and add it to hte output string + encoding += str(count) + l[i] + i = i + 1 + + return encoding + + +if __name__ == '__main__': + + l = 'ttttbccaadrrrr' + print(encode(l)) From 4e13831cc7dff0ed927bb41f8bdda21e0708da5a Mon Sep 17 00:00:00 2001 From: CharlesLake <83225043+CharlesLake@users.noreply.github.com> Date: Tue, 28 Sep 2021 17:42:01 -0400 Subject: [PATCH 2/4] Add files via upload --- challenge.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 challenge.html diff --git a/challenge.html b/challenge.html new file mode 100644 index 000000000..fe80bbd43 --- /dev/null +++ b/challenge.html @@ -0,0 +1,28 @@ + + +
+