Skip to content

Commit

Permalink
Little python project (#4)
Browse files Browse the repository at this point in the history
* add python project

* Add python test workflow

* simplify tests
  • Loading branch information
InnocentBug authored May 9, 2023
1 parent dfe8dd6 commit ed7a768
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test Python

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
install:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.11]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: test
run: python magic_python/core.py 17. 15
18 changes: 18 additions & 0 deletions magic_python/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import sys

def my_magic_function(x, y):
return x + y

def main(argv):
if len(argv) == 0:
print("Usage: python core.py number1 [number2 [,,.]]")
return -1

magic_result = 0
for arg in argv:
value = float(arg)
magic_result = my_magic_function(magic_result, value)
print(magic_result)

if __name__ == "__main__":
exit(main(sys.argv[1:]))

0 comments on commit ed7a768

Please sign in to comment.