diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 48d1bde..e1ba390 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -30,10 +30,11 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - pytest --continue-on-collection-errors + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git diff origin/main HEAD --name-only -- practice | xargs dirname | sort | uniq | xargs pytest - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics \ No newline at end of file diff --git a/practice/reverse-string/reverse_string.py b/practice/reverse-string/reverse_string.py index 4690cc7..731a1d7 100644 --- a/practice/reverse-string/reverse_string.py +++ b/practice/reverse-string/reverse_string.py @@ -1,2 +1,11 @@ -def reverse(text): - pass +def reverse(text): + reversed_text = "" + for i in range(len(text)-1, -1, -1): + reversed_text += text[i] + return reversed_text +pass + + # My approach -----> + # initialising empty string to hold reversed text + # iterating through string in reverse order + # appending each char from end to beginning \ No newline at end of file