It's just a compilation of challenges of python that you can learn how to code and the logic of it.
You can prove your outputs using the "Unitests.py" running the command "python -m unittest .\Unitests.py"
Given an encoded string, return its decoded output by following the pattern:
- A number
Nfollowed by[ ]means that the string inside the brackets should be repeatedNtimes. - The input string may contain nested brackets, which must be resolved from the innermost to the outermost level.
| Input | Expected Output |
|---|---|
"3[a]2[bc]" |
"aaabcbc" |
"3[a2[c]]" |
"accaccacc" |
- The input string contains only lowercase letters (
a-z), digits (0-9), and square brackets ([]). - The input is always well-formed (no unmatched brackets).
- The numbers represent positive integers.
def decode_string(input: str) -> str:
pass # Implement the function hereWrite a function to reverse a given string without using [::-1] or reversed().
| Input | Expected Output |
|---|---|
"hello" |
"olleh" |
"Python" |
"nohtyP" |
def reverse_string(input: str) -> str:
pass # Implement functio