File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 173
173
def convert_currency (
174
174
baseCurrency : str = "USD" ,
175
175
targetCurrency : str = "INR" ,
176
- amount : str = "25" ,
176
+ amount : float = 1.0 ,
177
177
apiKey : str = API_KEY ,
178
- ):
178
+ ) -> str :
179
179
"""https://www.amdoren.com/currency-api/"""
180
180
res = requests .get (
181
181
f"{ URL_BASE } ?api_key={ API_KEY } &from={ baseCurrency } &to={ targetCurrency } &amount={ amount } "
182
182
).json ()
183
183
if res ["error" ] == 0 :
184
- return res ["amount" ]
184
+ return str ( res ["amount" ])
185
185
return res ["error_message" ]
186
186
187
187
188
188
if __name__ == "__main__" :
189
189
base_currency = input ("Enter base currency: " ).strip ()
190
190
target_currency = input ("Enter target currency: " ).strip ()
191
- amount = input ("Enter the amount: " ).strip ()
191
+ amount = float ( input ("Enter the amount: " ).strip () )
192
192
print (
193
193
convert_currency (
194
194
baseCurrency = base_currency , targetCurrency = target_currency , amount = amount
You can’t perform that action at this time.
0 commit comments