import xml.etree.ElementTree as ET
import urllib.request
from decimal import Decimal


def currency_rates(currency):
    tree = ET.parse(urllib.request.urlopen('http://www.cbr.ru/scripts/XML_daily.asp'))
    root = tree.getroot()

    list_charcode = []
    list_value = []

    for elem in root:
        list_charcode.append(elem[1].text.lower())

    for elem in root:
        list_value.append(elem[4].text)

    dict_total = dict(zip(list_charcode, list_value))
    p = dict_total.setdefault(currency, '0')
    p = p.replace(',','.')
    p = Decimal(p)
    if p != 0:
        print(f'Текущий курс: {p.quantize(Decimal("1.0000"))} руб')
    else:
        print('!!!Нет такой валюты!!!')


currency = input('Ведите валюту: ')
currency_rates(currency.lower())
07b8b7b4ce94d5569ef8f50b96a45e05674c219c
<mask token>

<mask token>


def currency_rates(currency):
    tree = ET.parse(urllib.request.urlopen(
        'http://www.cbr.ru/scripts/XML_daily.asp'))
    root = tree.getroot()
    list_charcode = []
    list_value = []
    for elem in root:
        list_charcode.append(elem[1].text.lower())
    for elem in root:
        list_value.append(elem[4].text)
    dict_total = dict(zip(list_charcode, list_value))
    p = dict_total.setdefault(currency, '0')
    p = p.replace(',', '.')
    p = Decimal(p)
    if p != 0:
        print(f"Текущий курс: {p.quantize(Decimal('1.0000'))} руб")
    else:
        print('!!!Нет такой валюты!!!')


<mask token>
currency_rates(currency.lower())

<mask token>


def currency_rates(currency):
    tree = ET.parse(urllib.request.urlopen(
        'http://www.cbr.ru/scripts/XML_daily.asp'))
    root = tree.getroot()
    list_charcode = []
    list_value = []
    for elem in root:
        list_charcode.append(elem[1].text.lower())
    for elem in root:
        list_value.append(elem[4].text)
    dict_total = dict(zip(list_charcode, list_value))
    p = dict_total.setdefault(currency, '0')
    p = p.replace(',', '.')
    p = Decimal(p)
    if p != 0:
        print(f"Текущий курс: {p.quantize(Decimal('1.0000'))} руб")
    else:
        print('!!!Нет такой валюты!!!')


currency = input('Ведите валюту: ')
currency_rates(currency.lower())

import xml.etree.ElementTree as ET
import urllib.request
from decimal import Decimal


def currency_rates(currency):
    tree = ET.parse(urllib.request.urlopen(
        'http://www.cbr.ru/scripts/XML_daily.asp'))
    root = tree.getroot()
    list_charcode = []
    list_value = []
    for elem in root:
        list_charcode.append(elem[1].text.lower())
    for elem in root:
        list_value.append(elem[4].text)
    dict_total = dict(zip(list_charcode, list_value))
    p = dict_total.setdefault(currency, '0')
    p = p.replace(',', '.')
    p = Decimal(p)
    if p != 0:
        print(f"Текущий курс: {p.quantize(Decimal('1.0000'))} руб")
    else:
        print('!!!Нет такой валюты!!!')


currency = input('Ведите валюту: ')
currency_rates(currency.lower())

import xml.etree.ElementTree as ET
import urllib.request
from decimal import Decimal


def currency_rates(currency):
    tree = ET.parse(urllib.request.urlopen('http://www.cbr.ru/scripts/XML_daily.asp'))
    root = tree.getroot()

    list_charcode = []
    list_value = []

    for elem in root:
        list_charcode.append(elem[1].text.lower())

    for elem in root:
        list_value.append(elem[4].text)

    dict_total = dict(zip(list_charcode, list_value))
    p = dict_total.setdefault(currency, '0')
    p = p.replace(',','.')
    p = Decimal(p)
    if p != 0:
        print(f'Текущий курс: {p.quantize(Decimal("1.0000"))} руб')
    else:
        print('!!!Нет такой валюты!!!')


currency = input('Ведите валюту: ')
currency_rates(currency.lower())