Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rates = {'BGN': 1.0, 'USD': 1.79549, 'EUR': 1.95583, 'GBP': 2.53405}
- inputSum = float(input())
- currIn = input()
- currOut = input()
- def new_currency(curr_code):
- print("Currency rate for {} unavailable! \n To Add new rate type 'YES' \n".format(curr_code))
- answer = input()
- if answer == 'YES':
- print("Add rate for {} : \n".format(curr_code))
- new_rate = float(input())
- new_record = {curr_code: new_rate}
- rates[curr_code] = new_rate
- pass
- if rates.get(currIn) is None:
- new_currency(currIn)
- if rates.get(currOut) is None:
- new_currency(currOut)
- result = inputSum * rates.get(currIn) / rates.get(currOut)
- print("{:10.2f}".format(result) + " " + currOut)
Advertisement
Add Comment
Please, Sign In to add comment