def euroToDollar(euro_amount, kurs=1.15): return euro_amount * kurs def dollarToEuro(dollar_amount, kurs=1.15): return dollar_amount / kurs def main(): print("Währungs‐Umrechner ") print("Aktueller Kurs: 1€ = {:.2f} USD".format(1.15)) richtung = input("1) € auf $ \n 2) $ auf € \nIhre Wahl: ") if richtung == "1": euro_str = input("€: ") try: euro = float(euro_str.replace(",",".")) dollar = euroToDollar(euro, kurs=1.15) print(f"{euro:.2f}€ entsprechen {dollar:.2f}$") except ValueError as e: print(e) elif richtung == "2": usd_str = input("$: ") try: usd = float(usd_str.replace(",",".")) euro = dollarToEuro(usd, kurs=1.15) print(f"{usd:.2f} $ entsprechen {euro:.2f}€") except ValueError as e: print(e) else: print("wähle richtig") if __name__ == "__main__": main()