Last active
September 23, 2018 21:22
-
-
Save beltiras/fe0737f26ac27aebe85373f14ad67e4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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