Skip to content

Instantly share code, notes, and snippets.

View smythp's full-sized avatar

Patrick Smyth smythp

View GitHub Profile
@smythp
smythp / compunding.py
Last active April 14, 2020 22:22
Result of pair programming
def effectiverate(r, n): # r = interest rate per year, n = times of compounding per year
"""The effective annual interest rate is the real return on a savings account or any interest-paying
investment when the effects of compounding over time are taken into account. It also reveals the real
percentage rate owed in interest on a loan, a credit card, or any other debt."""
compounded_float = 1 + (r / n)
exponent_float = (compounded_float ** n ) - 1
return exponent_float
@smythp
smythp / image.resize.in.github.flavored.markdown.md
Last active November 20, 2017 03:42 — forked from uupaa/image.resize.in.github.flavored.markdown.md
image resize in github flavored markdown.

Image source

https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

Try resize it!

@smythp
smythp / factorial.el
Created August 4, 2017 20:37
Reverse factorial
(defun my-fac (num last total)
(if (> total num)
nil
(if (= (/ total num) 1)
last
(my-fac num (1+ last) (* (1+ last) total)))))
(my-fac 479001600 1 1)
;; 12
@smythp
smythp / gist:5ab7c2ba8bb573b8397d978eb6ee519f
Last active December 23, 2016 00:26
Fortress of Peril text adventure
# The Fortress of Peril
# A very incomplete text adventure
# Adapted from some code I wrote to
# better learn OOP in Python. The
# parser, entities, and loop would
# normally be their own modules.
# Only look/examine, move, and quit
# commands have been implemented.
@smythp
smythp / gist:caa6e5d8e41c33f136c202ea7907a60d
Created December 22, 2016 20:53
Fortress of Peril text adventure
# The Fortress of Peril
# A very incomplete text adventure
# Adapted from some code I wrote to
# better learn OOP in Python. The
# parser, entities, and loop would
# normally be their own modules.
# Only look/examine, move, and quit
# commands have been implemented.