Z19948

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z19948"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z19943",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z610",
            "Z16K2": "def Z19943(Z19943K1):\n\timport re\n\n\t#convert symbols to canonical forms\n\tnormalised_string = Z19943K1.replace(\"–\", \"-\")\n\tnormalised_string = normalised_string.replace(\"−\", \"-\")\n\tnormalised_string = normalised_string.replace('E', 'e')\n\n\t#ignore brackets\n\tnormalised_string = normalised_string.replace('(', \"\")\n\tnormalised_string = normalised_string.replace(')', \"\")\n\n\t#leading negatives are dealt with in the sign function\n\tnormalised_string = normalised_string.lstrip('-')\n\n\t# deal with / expressing a fraction\n\tif '/' in normalised_string:\n\t\tseparated_string = normalised_string.split(\"/\",1)\n\t\tnumerator_string = separated_string[0]\n\t\tdenominator_string = separated_string[1].lstrip('-')\n\telse:\n\t\tnumerator_string = normalised_string\n\t\tnumerator_string = numerator_string.replace(' ', \"\") #spaces are not a mixed fraction if there is no denominator\n\t\tdenominator_string = '1'\n\n\t# deal with percentages\n\tif '%' in numerator_string:\n\t\tdenom_multiplier = 100\n\t\tnumerator_string = numerator_string.replace('%', \"\")\n\telse:\n\t\tdenom_multiplier = 1\n\t\t\n\tnumer_multiplier = 1\n\t#deal with base 10 exponent \"e\"\n\tif 'e' in numerator_string:\n\t\tseparated_string = numerator_string.split(\"e\",1)\n\t\tnumerator_string = separated_string[0]\n\t\texponent_string = separated_string[1]\n\t\t\n\t\tif int(exponent_string)\u003C0:\n\t\t\tWikifunctions.Debug(exponent_string+\" exponent \u003C 0\")\n\t\t\tdenom_multiplier *= 10**abs(int(exponent_string))\n\t\telse:\n\t\t\tWikifunctions.Debug(exponent_string+\" exponent \u003E 0\")\n\t\t\tnumer_multiplier *= 10**int(exponent_string)\n\n\t#deal with base 10 exponent \"e\" in the denominator\n\tif 'e' in denominator_string:\n\t\tseparated_string = denominator_string.split(\"e\",1)\n\t\tdenominator_string = separated_string[0]\n\t\texponent_string = separated_string[1]\n\t\t\n\t\tif int(exponent_string)\u003C0:\n\t\t\tWikifunctions.Debug(exponent_string+\" exponent \u003C 0\")\n\t\t\tnumer_multiplier *= 10**abs(int(exponent_string))\n\t\telse:\n\t\t\tWikifunctions.Debug(exponent_string+\" exponent \u003E 0\")\n\t\t\tdenom_multiplier *= 10**int(exponent_string)\n\n\t# remove obvious separator marks\n\tif numerator_string.count('.') \u003E 1:\n\t\tnumerator_string = numerator_string.replace('.', \"\")\n\tif numerator_string.count(',') \u003E 1:\n\t\tnumerator_string = numerator_string.replace(',', \"\")\n\tif numerator_string.count(' ') \u003E 1:\n\t\tnumerator_string = numerator_string.replace(' ', \"\")\n\tif ',' in numerator_string and '.' in numerator_string:\n\t\tif numerator_string.find(',') \u003C numerator_string.find('.'):\n\t\t\tnumerator_string = numerator_string.replace(',', \"\")\n\t\telse:\n\t\t\tnumerator_string = numerator_string.replace('.', \"\")\n\n\tif denominator_string.count('.') \u003E 1:\n\t\tdenominator_string = denominator_string.replace('.', \"\")\n\tif denominator_string.count(',') \u003E 1:\n\t\tdenominator_string = denominator_string.replace(',', \"\")\n\tif denominator_string.count(' ') \u003E 1:\n\t\tdenominator_string = denominator_string.replace(' ', \"\")\n\tif ',' in denominator_string and '.' in denominator_string:\n\t\tif denominator_string.find(',') \u003C denominator_string.find('.'):\n\t\t\tdenominator_string = denominator_string.replace(',', \"\")\n\t\telse:\n\t\t\tdenominator_string = denominator_string.replace('.', \"\")\n\t\n\t# deal with mixed fractions, need to multiply initial integer by denominator, then add it to numerator\n\tif ' ' in numerator_string:\n\t\tdenominator_string = denominator_string.replace('.', \"\")\n\t\tdenominator_string = denominator_string.replace(',', \"\")\n\t\tdenominator_string = denominator_string.replace(' ', \"\")\n\t\tdenominator = int(denominator_string)\n\t\treturn denominator\n\n\t# deal with decimals\n\tnumerator_string = numerator_string.replace(',', '.')\n\tif '.' in numerator_string:\n\t\tdecimal_places = len(numerator_string.split(\".\")[1])\n\t\tfor i in range(decimal_places):\n\t\t\tdenom_multiplier *= 10\n\t\tnumerator_string = numerator_string.replace('.', \"\")\n\t\n\tdenominator_string = denominator_string.replace(' ', \"\")\n\treturn denom_multiplier*int(denominator_string)"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "unsimplified denominator of string, python"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "# Z504"
            }
        ]
    }
}