Skip to content

Instantly share code, notes, and snippets.

@hedihadi
Last active January 7, 2022 18:28
Show Gist options
  • Save hedihadi/4fee303d687a5ed0cadd2644c2acec7c to your computer and use it in GitHub Desktop.
Save hedihadi/4fee303d687a5ed0cadd2644c2acec7c to your computer and use it in GitHub Desktop.
تایبەت بە خۆت دروست بکە API ئەم سکرێپتە دراوە جیهانیەکان بۆ دینار دەگۆڕێت، تەنها پێویستی بە نرخی دۆلار هەیە، تکایە ئەگەر سکرێپتەکەت بەکارهێنا
import json
from urllib.request import Request, urlopen
import re
import datetime
import time
''''''''''''''''''''''''''''''''''''
'''calculate the currency prices from exchangeratesapi'''
''''''''''''''''''''''''''''''''''''
print("\n\n\n\n")
'''pewista nrxi dolar bdayt ba scriptaka'''
usdprice=int(input("usd price: "))
req = Request(f'http://api.exchangeratesapi.io/v1/latest?access_key=6b0b7745e50841dee45515ae1851a0d0&format=1', headers={'User-Agent': 'Mozilla/5.0'})
currencies=json.load(urlopen(req))
'''nrxi har drawek lam API'awa barambar 1 euro 7sab krawa, pewista aw drawanay eshman peyati la 1 eurowa bigorin bo 1 dolar '''
usdbase=currencies['rates']['USD']
temporary=((1/usdbase)*currencies['rates']['TRY']*100)
turkishlira=usdprice/temporary*100
temporary=((1/usdbase)*currencies['rates']['GBP']*100)
poundprice=usdprice/temporary*100
temporary=((1/usdbase)*currencies['rates']['EUR']*100)
europrice=usdprice/temporary*100
''''''''''''''''''''''''''''''''''''
'''calculate the currency prices from exchangeratesapi'''
''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''
'''calculate tman price'''
''''''''''''''''''''''''''''''''''''
'''nrxi 1000 dinar barambar chand tmana'''
tmanprice=input("tman price: ")
'''am hawkeshaya nrxakay sarawa agore boiy bzanin 100,000 tman chand hazar dinara'''
tmanprice=100000*(1000/int(tmanprice))
''''''''''''''''''''''''''''''''''''
'''calculate tman price'''
''''''''''''''''''''''''''''''''''''
print("100 pound =",poundprice," dinar")
print("100 lira =",turkishlira," dinar")
print("100 euro =",europrice," dinar")
print("100,000 tman =",tmanprice," dinar")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment