Skip to content

Instantly share code, notes, and snippets.

View Adobe-Android's full-sized avatar

David Brown Adobe-Android

View GitHub Profile
@Adobe-Android
Adobe-Android / years_as_fractions.py
Created May 13, 2024 22:57
Calculate the number of months corresponding to a year fraction
#!/bin/env python3
def main():
months_in_year = 12
portion_of_year = 7.6
print(months_in_year * portion_of_year)
if __name__ == "__main__":
main()
@Adobe-Android
Adobe-Android / share_count.py
Last active May 13, 2024 22:52
Calculate the number of shares you can buy when providing share price and dollars to invest
#!/bin/env python3
def main():
share_price = 16.50
investable_dollars = 825
share_count = 0
share_count = investable_dollars / share_price
print(f"At a share price of ${share_price} and an investment of {investable_dollars}, you can purchase {share_count} shares")
@Adobe-Android
Adobe-Android / expected_dividends.py
Created May 13, 2024 22:46
Calculate expected dividends for a given period
#!/bin/env python3
def main():
dividend_per_share = 0.2775
# Payout frequency within a year
# 4 for quarterly, 12 for monthly
# For 2 years, assuming quarterly payments, 8 would be an appropriate frequency
dividend_frequency = 4
share_count = 1
@Adobe-Android
Adobe-Android / investment_compounding.py
Created May 13, 2024 22:33
Codify compound interest formulas
#!/bin/env python3
# Formula Resources:
# https://www.omnicalculator.com/finance/compound-interest#example-2-complex-calculation-of-the-value-of-an-investment
def main():
starting_balance = 5_000
years_to_achieve = 1
rate_of_return = 0.03
compound_frequency = 12 # number of times compounded per year
#!/bin/env python3
def main():
purchase_price = 100
current_price = 200
percentage_change = round(((current_price - purchase_price) / purchase_price) * 100, 2)
print(f"At ${current_price}, that is a change of {percentage_change}% from ${purchase_price}")
if __name__ == "__main__":
#!/bin/env python3
def main():
y = 13
x = 52
percentage = round((y / x) * 100)
print(f"{y} is {percentage}% of {x}")
if __name__ == "__main__":
@Adobe-Android
Adobe-Android / percent_diff.py
Last active April 16, 2024 21:09
Find the percentage difference between two numbers
#!/bin/env python3
def main():
num1 = 80
num2 = 100
absolute = abs(num1 - num2)
average = (num1 + num2) / 2
answer = round((absolute / average) * 100)
@Adobe-Android
Adobe-Android / midpoint.py
Last active April 3, 2024 15:47
An easy way to find the midpoint between two numbers
#!/bin/env python3
def main():
num1 = 29.89
num2 = 29.86
midpoint = (num1 + num2) / 2
print(midpoint)
if __name__ == "__main__":
main()
@Adobe-Android
Adobe-Android / divisible.py
Created October 9, 2023 16:07
Divisibility Test
#!/bin/env python3
def main():
dividend = 1500
divisor = 52
limit = 6500
increment_num = 100
while dividend <= limit:
# print(dividend)
@Adobe-Android
Adobe-Android / obs_twitch_chat.css
Last active March 16, 2023 09:47 — forked from Bluscream/obs_twitch_chat.css
Twitch chat transparent popout for OBS
/*
Twitch chat browsersource CSS for OBS
Just set the URL as https://www.twitch.tv/%%TWITCHCHANNEL%%/chat?popout=true
And paste this entire file into the CSS box
Original by twitch.tv/starvingpoet modified by github.com/Bluscream and later github.com/Adobe-Android
General Settings
*/
body {
color: #FFFFFF!important;