Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
dd852d9
fixed docstring errors
Dec 12, 2016
aac934e
fixed docstring errors
Dec 12, 2016
f971f9a
fixed docstring errors
Dec 12, 2016
9801a07
completed tests for parenthetics.py
Dec 19, 2016
bfdd5ca
wrote paranthetics using previous Stack functions. Tests written and …
Dec 19, 2016
0ac9159
Update README.md
serashioda Dec 19, 2016
afd2560
Update
serashioda Dec 19, 2016
e4b3bfe
Update
serashioda Dec 19, 2016
db28faa
updated tests for 100% coverage.
Dec 19, 2016
c194248
updated tests for 100% coverage.
Dec 19, 2016
c4823a4
tests passing.
Jan 2, 2017
e021558
update .gitignore
Jan 18, 2017
e2e5773
gitc
Jan 18, 2017
fc1a370
AutoCompleter class and methods, __init__ and complete done. Tests ad…
Jan 18, 2017
87b97fc
initial setup for forbes kata
Feb 21, 2017
c08e0f5
def watch_pyramid_from_the_side done.
Feb 22, 2017
579735e
def watch_pyramid_from_above done. starting tests.
Feb 22, 2017
d46d4b0
last two methods done and passing on codewars. Starting tests.
Feb 22, 2017
6c9f47e
tests for empty string, None, and two charac cases added. passing.
Feb 22, 2017
40414b5
more tests added for 3 charac cases. all passing.
Feb 22, 2017
0417237
Update README.md
serashioda Feb 22, 2017
c0be1a6
Update
serashioda Feb 22, 2017
d4cb73f
Update README.md
serashioda Feb 22, 2017
1e88000
added decender order test. passing.
Feb 22, 2017
11e2aa7
Merge branch 'string-pyramid' of https://github.com/serashioda/code-k…
Feb 22, 2017
603e333
find oldest billionaire under 80 years old and youngest billionaire …
Feb 22, 2017
082b2a2
added function to call both oldest under 80 and youngest valid.
Feb 22, 2017
990e347
updated forbes.py to work with test file. Tests written. All passing.
Feb 23, 2017
fc252bf
Update README.md
serashioda Feb 23, 2017
292d88c
Update
serashioda Feb 23, 2017
83ee726
Update
serashioda Feb 23, 2017
13298b6
take out unnecessary code.
Feb 23, 2017
b00690e
Merge branch 'forbes' of https://github.com/serashioda/code-katas int…
Feb 23, 2017
085c6c9
initial setup.
Feb 23, 2017
fd3044a
basic framework setup for flight_path. Also imported shortest_path to…
Feb 23, 2017
5bbdcde
tests done. all passing. took out print statements and pdb's
Feb 23, 2017
6b8332a
brought in shortest_path, stack, and linked_list from data structures.
Feb 23, 2017
ef0d2bf
Update README.md
serashioda Feb 23, 2017
0b6fb1a
Update
serashioda Feb 23, 2017
0ab8913
.gitignore
Feb 24, 2017
10cb401
Merge branch 'flight-paths' of https://github.com/serashioda/code-kat…
Feb 24, 2017
4e0b481
remove env files
Feb 24, 2017
8ebd2f1
corpse code
Feb 24, 2017
f9284c0
remove print statements
Feb 24, 2017
baa937b
corpse code
Feb 24, 2017
356742b
Merge branch 'master' into string-pyramid
serashioda Feb 24, 2017
f99dcbb
docstring. minor syntax edits. .gitignore.
Feb 24, 2017
461f8f6
Merge branch 'string-pyramid' of https://github.com/serashioda/code-k…
Feb 24, 2017
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var/
.installed.cfg
*.egg
bin/
include/
.DS_Store
pyvenv.cfg

# PyInstaller
Expand Down
52 changes: 50 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Repo containing my solutions from Code War katas.
Repo containing my solutions from Code Katas.

###8kyu

Expand Down Expand Up @@ -140,4 +140,52 @@ def find_it(xs):
```
def countBits(n):
return bin(n).count("1")
```


####String Pyramid:
- MODULE: string_pyramid.py
- TESTS: test_string_pyramid.py
- LINKS: [String Pyramid - Kata](http://www.codewars.com/kata/string-pyramid/train/python),
[Solutions](http://www.codewars.com/kata/5797d1a9c38ec2de1f00017b/solutions/python/all/clever)
- Interesting solution by lechevalier:
```
def watch_pyramid_from_the_side(c, i=1, acc=[]):
if c == None: return c
if not c: return '\n'.join(acc)
return watch_pyramid_from_the_side(c[:-1], i+2, [' '+l+' 'for l in acc]+[c[-1]*i])

def watch_pyramid_from_above(c, i=1, acc=[]):
if c == None: return c
if not c: return '\n'.join(acc)
return watch_pyramid_from_above(c[:-1], i+2, [c[-1] * i] + [c[-1]+l+c[-1] for l in acc] + [c[-1] * i] * bool(acc))

def count_visible_characters_of_the_pyramid(c):
return c and (2*len(c)-1)**2 or -1

def count_all_characters_of_the_pyramid(c):
return c and (4*len(c)**3-len(c))//3 or -1
```


###Other


####Interview Challenge: Proper Parenthetics
- Module: proper-parenthetics.py
- TESTS: test_proper-parenthetics.py
- LINKS: [ASSIGNMENT LINK](https://codefellows.github.io/sea-python-401d5/assignments/proper_parenthetics.html?highlight=proper%20paren)
- DERIVED FROM: [data-structures repo. Specifically stack branch](https://github.com/ellezv/data_structures/tree/stack), collaborated with Maelle Vance.

####Python Practice: The Forbes Top 40
- Module: forbes.py
- JSON data: forbes.json
- TESTS: test_forbes.py
- LINKS: [ASSIGNMENT LINK](https://codefellows.github.io/sea-python-401d5/assignments/kata_forbes_billionaires.html)

####Python Practice: Distance Between Points
- Module: flight_paths.py
- Reference module: shortest_path_stack_linked_lst.py
- JSON data: flight_paths.json
- TESTS: test_flight_paths.py
- CREDIT: Haversine Formula derived from [Stack Overflow- Haversine Formula in Python (Bearing and Distance between two GPS points)](http://stackoverflow.com/questions/4913349/haversine-formula-in-python-bearing-and-distance-between-two-gps-points)
- LINKS: [ASSIGNMENT LINK](https://codefellows.github.io/sea-python-401d5/assignments/kata_flight_paths.html)
21 changes: 21 additions & 0 deletions src/autocomplete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Implementation of the autocomplete module."""


class AutoCompleter():
"""Auto completer class."""

def __init__(self, vocabulary, max_completions=4):
"""Instantiate with vocabulary and max_compete params."""
self.vocabulary = vocabulary
self.max_completions = max_completions

def complete(self, term):
"""Match terms to max of 4 words, then append and return."""
suggested_words = []
n = len(term)
for word in self.vocabulary:
if word[:n] == term:
suggested_words.append(word)
if len(suggested_words) >= self.max_completions:
return suggested_words
return suggested_words
3 changes: 2 additions & 1 deletion src/calculate_years.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@


def calculate_years(principal, interest, tax, desired):
"""Caculate how many years it take to reach desired principle."""
"""Calculate how many years it take to reach desired principle."""

years = 0
while (principal < desired):
accrued = principal * interest
Expand Down
Loading