Skip to content

Instantly share code, notes, and snippets.

@gunnarig
Last active September 23, 2018 21:20
Show Gist options
  • Save gunnarig/70201d42277b8562a10e926d48a78b24 to your computer and use it in GitHub Desktop.
Save gunnarig/70201d42277b8562a10e926d48a78b24 to your computer and use it in GitHub Desktop.
from fractions import Fraction
def integer(first):
while first is int:
return True
def fraction(second):
while second is Fraction:
return True
#def share_price(mult):
#shares * price = mult
#print(mult)
#[int(i) for i in input().split()]
#
while True:
#try:
#int(input("Enter number of shares: "))
#except ValueError:
#print("Invalid number!")
price = Fraction(a,b+c,d)(input("Enter price ( dollars, numerator, denominator: "))
print(price)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment