Currency Convert, Dollar, Euro, Yen, Pound
DillFire55
python
a year ago
6.0 kB
5
Indexable
def GetAmount(amount): global numbers numbers = "" for i in amount: if i.isdigit() or i == ".": numbers += i numbers = float(numbers) numbers = "{:.2f}".format(numbers) def Dollar(numbers): print("") Euro = round(float(numbers) * 0.94, 2) Euro = "{:.2f}".format(Euro) Euro = str(Euro) Yen = round(float(numbers) * 115.16, 2) Yen = "{:.2f}".format(Yen) Yen = str(Yen) Pound = round(float(numbers) * 0.79, 2) Pound = "{:.2f}".format(Pound) Pound = str(Pound) GEuro = round(float(numbers) * 0.91, 2) GEuro = "{:.2f}".format(GEuro) GEuro = str(GEuro) GYen = round(float(numbers) * 144.67, 2) GYen = "{:.2f}".format(GYen) GYen = str(GYen) GPound = round(float(numbers) * 0.79, 2) GPound = "{:.2f}".format(GPound) GPound = str(GPound) print("You have $"+str(numbers)) print("That is €"+Euro+" (Google: €"+GEuro+")") print("That is ¥"+Yen+"(Google: ¥"+GYen+")") print("That is £"+Pound+" (Google: £"+GPound+")") print("") def Euro(numbers): print("") Dollar = round(float(numbers) * 1.06, 2) Dollar = "{:.2f}".format(Dollar) Dollar = str(Dollar) Yen = round(float(numbers) * 158.26, 2) Yen = "{:.2f}".format(Yen) Yen = str(Yen) Pound = round(float(numbers) * 0.86, 2) Pound = "{:.2f}".format(Pound) Pound = str(Pound) GDollar = round(float(numbers) * 1.09, 2) GDollar = "{:.2f}".format(GDollar) GDollar = str(GDollar) GYen = round(float(numbers) * 158.26, 2) GYen = "{:.2f}".format(GYen) GYen = str(GYen) GPound = round(float(numbers) * 0.86, 2) GPound = "{:.2f}".format(GPound) GPound = str(GPound) print("You have €"+str(numbers)) print("That is $"+Dollar+" (Google: $"+GDollar+")") print("That is ¥"+Yen+"(Google: ¥"+GYen+")") print("That is £"+Pound+" (Google: £"+GPound+")") print("") def Yen(numbers): print("") Dollar = round(float(numbers) * 0.0086, 2) Dollar = "{:.2f}".format(Dollar) Dollar = str(Dollar) Euro = round(float(numbers) * 0.0063, 2) Euro = "{:.2f}".format(Euro) Euro = str(Euro) Pound = round(float(numbers) * 0.0054, 2) Pound = "{:.2f}".format(Pound) Pound = str(Pound) GDollar = round(float(numbers) * 0.0069, 2) GDollar = "{:.2f}".format(GDollar) GDollar = str(GDollar) GEuro = round(float(numbers) * 0.0063, 2) GEuro = "{:.2f}".format(GEuro) GEuro = str(GEuro) GPound = round(float(numbers) * 0.0054, 2) GPound = "{:.2f}".format(GPound) GPound = str(GPound) print("You have ¥"+str(numbers)) print("That is $"+Dollar+" (Google: $"+GDollar+")") print("That is €"+Euro+"(Google: €"+GEuro+")") print("That is £"+Pound+" (Google: £"+GPound+")") print("") def Pound(numbers): print("") Dollar = round(float(numbers) * 1.27, 2) Dollar = "{:.2f}".format(Dollar) Dollar = str(Dollar) Euro = round(float(numbers) * 1.16, 2) Euro = "{:.2f}".format(Euro) Euro = str(Euro) Yen = round(float(numbers) * 184.07, 2) Yen = "{:.2f}".format(Yen) Yen = str(Yen) GDollar = round(float(numbers) * 1.27, 2) GDollar = "{:.2f}".format(GDollar) GDollar = str(GDollar) GEuro = round(float(numbers) * 1.16, 2) GEuro = "{:.2f}".format(GEuro) GEuro = str(GEuro) GYen = round(float(numbers) * 184.07, 2) GYen = "{:.2f}".format(GYen) GYen = str(GYen) print("You have £"+str(numbers)) print("That is $"+Dollar+" (Google: $"+GDollar+")") print("That is €"+Euro+"(Google: €"+GEuro+")") print("That is ¥"+Yen+" (Google: ¥"+GYen+")") print("") print("Main conversions containing dollars (and not pounds) use buzz page exchange rates, the others use google exchange rates, all google conversions use google exchange rates.") print("") print("Please include only 1 type of currency (whether symbol or word), of the kind you want to convert. Use decimal point (.) for decimal values to represent cents per respective currency. Inclusion of commas (,) for seperation of thousands are optional and will not be included. Enter end to end program") print("") print("$1.00 = €0.94 (Dollars to Euros)(google current: $1.00 = €0.91)") print("$1.00 = ¥115.16 (Dollars to Yen)(google current: $1.00 = ¥144.67)") print("$1.00 = £0.79 (Dollars to Pounds)(google current: $1.00 = £0.79)") print("") print("€1.00 = $1.06 (Euros to Dollars)(google current: €1.00 = $1.09)") print("€1.00 = ¥158.26 (Euros to Yen)(google current: €1.00 = ¥158.26)") print("€1.00 = £0.86 (Euros to Pounds)(google current: €1.00 = £0.86)") print("") print("¥1.00 = $0.0086 (Yen to Dollars)(google current: ¥1.00 = $0.0069)") print("¥1.00 = €0.0063 (Yen to Euros)(google current: ¥1.00 = €0.0063)") print("¥1.00 = £0.0054 (Yen to Pounds)(google current: ¥1.00 = £0.0054)") print("") print("£1.00 = $1.27 (Pounds to Dollars)(google current: £1.00 = $1.27)") print("£1.00 = €1.16 (Pounds to Euros)(google current: £1.00 = €1.16)") print("£1.00 = ¥184.06 (Pounds to Yen)(google current: £1.00 = ¥184.07)") print("") while True: amount = input("Enter amount to convert, use either symbol or word (example: $ or dollar): ") if "$" in amount.lower() or "dollar" in amount.lower() or "dollars" in amount.lower(): GetAmount(amount) Dollar(numbers) if "€" in amount.lower() or "euro" in amount.lower() or "euros" in amount.lower(): GetAmount(amount) Euro(numbers) if "¥" in amount.lower() or "yen" in amount.lower(): GetAmount(amount) Yen(numbers) if "£" in amount.lower() or "pound" in amount.lower() or "pounds" in amount.lower(): GetAmount(amount) Pound(numbers) if amount.lower() == "end": break
Editor is loading...
Leave a Comment