Skip to content

Instantly share code, notes, and snippets.

@beltiras
Last active September 23, 2018 21:22
Show Gist options
  • Save beltiras/fe0737f26ac27aebe85373f14ad67e4b to your computer and use it in GitHub Desktop.
Save beltiras/fe0737f26ac27aebe85373f14ad67e4b to your computer and use it in GitHub Desktop.
from fractions import Fraction
def integer(first):
try:
i = int(first)
except:
return False
return True
def fraction(second):
if type(second) == Fraction:
return True
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!")
a,b,c = input("Enter price (dollars, numerator, denominator): ").split(" ")
price = Fraction(int(a),1)+Fraction(int(b),int(c))
print(price)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment