Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse-string #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions practice/reverse-string/reverse_string.py
Original file line number Diff line number Diff line change
@@ -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
Loading