{
  "id": "P180",
  "slug": "power-strip",
  "key": "P180-power-strip",
  "title": "Power strip",
  "summary": "An extension lead rated 10 A: two heaters each well under it draw 13.0 A together, and a 240 V heater on a 120 V supply gives a quarter of its heat.",
  "entry": "main.eml",
  "ui": "terminal",
  "readme": "# P180 - Power strip\n\nAn extension lead rated 10 A on a 230 V supply, the appliances that might\nshare it, and a heater taken abroad.\n\n- `main.eml` - the menu, the lead, two heaters, a heater abroad,\n  appliances of your own, and a heater of your own\n- `power.eml` - the supply and the rating, the appliances, current in\n  tenths of an amp, and a heater's power at another voltage\n\nHow each part works:\n\n- Current is power over voltage, kept in tenths of an amp and rounded\n  half-up from exact integers.\n- As in the corpus case `each-heater-was-within-the-rating-and-together-they-were-not`,\n  each 1,500 W heater draws 6.5 A, well under the lead's 10 A, and the two\n  together draw 13.0 A, 130% of the rating: the rating is for everything\n  plugged in at once. The heat in the lead goes with the square of the\n  current, 1.70 times what it was built to carry.\n- As in `half-the-voltage-was-a-quarter-of-the-heat`, a 2,000 W heater built\n  for 240 V is a fixed resistance of 28.8 ohms: on 120 V it draws half the\n  current, 4.2 A instead of 8.3, and gives a quarter of the heat, 500 W.\n  On more voltage than it was built for, the heat rises with the square.\n\nWhat is checked: menu choices 1 to 6; 1 to 4 different appliances by\nnumber, separated by spaces; a heater of 100 to 3000 W and voltages of 100\nto 250. An empty answer cancels.\n\nSessions: `sessions/basic.in` gives:\n- the lead, the two heaters and the heater abroad;\n- appliances of your own: a heater with a lamp and a laptop, a heater with\n  the kettle, and four at once;\n- heaters of your own: 2000 W for 240 V on 120 V, 1000 W for 120 V on 230\n  V, and 1500 W on the voltage it was built for.\n\n`sessions/bad-input.in` gives:\n- menu choices 0 and x;\n- appliances: a cancel, 7, 1 1, five numbers, x, 1,2 and 0, then 6 5;\n- heaters: a cancel, 99, 3001 and x; voltages: a cancel, 99, 251, then a\n  cancel and x;\n- 100 W built for 250 V on 100 V.\n\nBuilt on the verified corpus cases `each-heater-was-within-the-rating-and-together-they-were-not`\n(two 1500 W heaters on a 10 A extension lead) and\n`half-the-voltage-was-a-quarter-of-the-heat` (a 240 V heater on a 120 V\nsupply).\n",
  "modules": [
    {
      "name": "main.eml",
      "eml": "# P180 power strip: an extension lead and what shares it - the lead, two\n# heaters, a heater taken abroad, appliances of your own, and a heater of\n# your own.\nimport power\n\ndef plain(s):\n    0 => i\n    len(s) => j\n    while i < j and s[i] == \" \":\n        i + 1 => i\n    while j > i and s[j - 1] == \" \":\n        j - 1 => j\n    return s[i:j]\n\ndef pad(s, n):\n    s => out\n    while len(out) < n:\n        out + \" \" => out\n    return out\n\ndef lpad(s, n):\n    s => out\n    while len(out) < n:\n        \" \" + out => out\n    return out\n\ndef digits(t):\n    for c in t:\n        if c < \"0\" or c > \"9\":\n            return False\n    return len(t) > 0\n\ndef commas(n):\n    str(n) => s\n    \"\" => out\n    0 => k\n    len(s) => i\n    while i > 0:\n        if k == 3:\n            \",\" + out => out\n            0 => k\n        s[i - 1] + out => out\n        k + 1 => k\n        i - 1 => i\n    return out\n\ndef a1(t):\n    return str(int((t - t % 10) / 10)) + \".\" + str(t % 10) + \" A\"\n\ndef hundredths(h):\n    h % 100 => r\n    if r < 10:\n        return str(int((h - r) / 100)) + \".0\" + str(r)\n    return str(int((h - r) / 100)) + \".\" + str(r)\n\ndef show_lead():\n    (\"An extension lead with \" + str(power.sockets()) + \" sockets, rated \" + str(power.rating()) + \" A, on a \" + str(power.supply()) + \" V supply: \" + commas(power.rating() * power.supply()) + \" W at most, for all its sockets together.\") ^0\n    \"Appliances that might share it:\" ^0\n    0 => i\n    for a in power.appliances():\n        (\"  \" + str(i + 1) + \"  \" + pad(a[0], 14) + lpad(commas(a[1]) + \" W\", 8) + lpad(a1(power.amps_tenths(a[1], power.supply())), 8)) ^0\n        i + 1 => i\n\ndef load(ws):\n    # [watts, tenths of an amp, percent of the rating, heat in the lead as hundredths of what it was rated for]\n    0 => w\n    for x in ws:\n        w + x => w\n    power.half_up(w * 100, power.rating() * power.supply()) => pc\n    power.half_up(w * w * 100, power.supply() * power.supply() * power.rating() * power.rating()) => heat\n    return [w, power.amps_tenths(w, power.supply()), pc, heat]\n\ndef show_heaters():\n    power.appliances()[0][1] => w\n    load([w, w]) => l\n    (\"Two heaters of \" + commas(w) + \" W: each draws \" + a1(power.amps_tenths(w, power.supply())) + \", well under \" + str(power.rating()) + \".\") ^0\n    (\"Together they draw \" + commas(l[0]) + \" W, \" + a1(l[1]) + \", on a lead rated \" + str(power.rating()) + \" A: \" + str(l[2]) + \"% of its rating. The rating is for the lead, not for each socket.\") ^0\n    (\"The heat in the lead and its plug goes with the square of the current: \" + hundredths(l[3]) + \" times what it was built to carry.\") ^0\n\ndef show_abroad():\n    2000 => w\n    240 => rated\n    120 => volts\n    power.half_up(rated * rated * 10, w) => ohms\n    (\"A \" + commas(w) + \" W heater built for \" + str(rated) + \" V is plugged into a \" + str(volts) + \" V supply with a plug adapter. Its element is a fixed resistance, \" + str(int((ohms - ohms % 10) / 10)) + \".\" + str(ohms % 10) + \" ohms.\") ^0\n    (\"At half the voltage it draws half the current, \" + a1(power.amps_tenths(w, rated)) + \" down to \" + a1(power.amps_tenths(power.watts_at(w, rated, volts), volts)) + \", and gives a quarter of the heat: \" + commas(power.watts_at(w, rated, volts)) + \" W, not \" + commas(int(w / 2)) + \".\") ^0\n\ndef own_plug():\n    plain(input(\"appliances by number, e.g. 1 4 5> \")) => t\n    if t == \"\":\n        \"Cancelled.\" ^0\n        return\n    [] => picked\n    \"\" => cur\n    True => ok\n    for c in t + \" \":\n        if c == \" \":\n            if cur != \"\":\n                if len(cur) != 1 or not digits(cur) or int(cur) < 1 or int(cur) > len(power.appliances()):\n                    False => ok\n                else:\n                    for p in picked:\n                        if p == int(cur):\n                            False => ok\n                    picked + [int(cur)] => picked\n                \"\" => cur\n        else:\n            cur + c => cur\n    if not ok or len(picked) == 0 or len(picked) > power.sockets():\n        (\"Type 1 to \" + str(power.sockets()) + \" different numbers from 1 to \" + str(len(power.appliances())) + \", separated by spaces.\") ^0\n        return\n    [] => ws\n    \"\" => names\n    for p in picked:\n        power.appliances()[p - 1] => a\n        ws + [a[1]] => ws\n        if names != \"\":\n            names + \", \" => names\n        names + a[0] => names\n    load(ws) => l\n    (names + \": \" + commas(l[0]) + \" W, \" + a1(l[1]) + \", \" + str(l[2]) + \"% of the rating.\") ^0\n    if l[0] > power.rating() * power.supply():\n        (\"Over the rating: unplug something before the lead runs hot, at \" + hundredths(l[3]) + \" times the heat it was built for.\") ^0\n    else:\n        \"Within the rating.\" ^0\n\ndef number(prompt, lo, hi):\n    plain(input(prompt + \" (\" + str(lo) + \" to \" + str(hi) + \")> \")) => t\n    if t == \"\":\n        \"Cancelled.\" ^0\n        return 0 - 1\n    if len(t) > len(str(hi)) or not digits(t) or int(t) < lo or int(t) > hi:\n        (\"Type a whole number from \" + str(lo) + \" to \" + str(hi) + \".\") ^0\n        return 0 - 1\n    return int(t)\n\ndef own_heater():\n    number(\"heater watts\", 100, 3000) => w\n    if w < 0:\n        return\n    number(\"volts it was built for\", 100, 250) => rated\n    if rated < 0:\n        return\n    number(\"volts of the supply\", 100, 250) => volts\n    if volts < 0:\n        return\n    power.watts_at(w, rated, volts) => p\n    (\"A \" + commas(w) + \" W heater built for \" + str(rated) + \" V gives \" + commas(p) + \" W on \" + str(volts) + \" V.\") ^0\n    if volts < rated:\n        \"Less voltage, and the heat falls with its square.\" ^0\n    elif volts > rated:\n        \"More than it was built for: the heat rises with the square of the voltage, past what the element is made to take.\" ^0\n    else:\n        \"The voltage it was built for.\" ^0\n\n\"== Power strip ==\" ^0\n\"An extension lead, what shares it, and a heater taken abroad.\" ^0\nTrue => running\nwhile running:\n    \"\" ^0\n    \"1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\" ^0\n    plain(input(\"choice> \")) => choice\n    if choice == \"1\":\n        show_lead()\n    elif choice == \"2\":\n        show_heaters()\n    elif choice == \"3\":\n        show_abroad()\n    elif choice == \"4\":\n        own_plug()\n    elif choice == \"5\":\n        own_heater()\n    elif choice == \"6\":\n        False => running\n    else:\n        \"Pick a number from 1 to 6.\" ^0\n\"Bye.\" ^0\n",
      "python": "import power\n\ndef plain(s):\n    i = 0\n    j = len(s)\n    while i < j and s[i] == \" \":\n        i = i + 1\n    while j > i and s[j - 1] == \" \":\n        j = j - 1\n    return s[i:j]\n\ndef pad(s, n):\n    out = s\n    while len(out) < n:\n        out = out + \" \"\n    return out\n\ndef lpad(s, n):\n    out = s\n    while len(out) < n:\n        out = \" \" + out\n    return out\n\ndef digits(t):\n    for c in t:\n        if c < \"0\" or c > \"9\":\n            return False\n    return len(t) > 0\n\ndef commas(n):\n    s = str(n)\n    out = \"\"\n    k = 0\n    i = len(s)\n    while i > 0:\n        if k == 3:\n            out = \",\" + out\n            k = 0\n        out = s[i - 1] + out\n        k = k + 1\n        i = i - 1\n    return out\n\ndef a1(t):\n    return str(int((t - t % 10) / 10)) + \".\" + str(t % 10) + \" A\"\n\ndef hundredths(h):\n    r = h % 100\n    if r < 10:\n        return str(int((h - r) / 100)) + \".0\" + str(r)\n    return str(int((h - r) / 100)) + \".\" + str(r)\n\ndef show_lead():\n    print(\"An extension lead with \" + str(power.sockets()) + \" sockets, rated \" + str(power.rating()) + \" A, on a \" + str(power.supply()) + \" V supply: \" + commas(power.rating() * power.supply()) + \" W at most, for all its sockets together.\")\n    print(\"Appliances that might share it:\")\n    i = 0\n    for a in power.appliances():\n        print(\"  \" + str(i + 1) + \"  \" + pad(a[0], 14) + lpad(commas(a[1]) + \" W\", 8) + lpad(a1(power.amps_tenths(a[1], power.supply())), 8))\n        i = i + 1\n\ndef load(ws):\n    w = 0\n    for x in ws:\n        w = w + x\n    pc = power.half_up(w * 100, power.rating() * power.supply())\n    heat = power.half_up(w * w * 100, power.supply() * power.supply() * power.rating() * power.rating())\n    return [w, power.amps_tenths(w, power.supply()), pc, heat]\n\ndef show_heaters():\n    w = power.appliances()[0][1]\n    l = load([w, w])\n    print(\"Two heaters of \" + commas(w) + \" W: each draws \" + a1(power.amps_tenths(w, power.supply())) + \", well under \" + str(power.rating()) + \".\")\n    print(\"Together they draw \" + commas(l[0]) + \" W, \" + a1(l[1]) + \", on a lead rated \" + str(power.rating()) + \" A: \" + str(l[2]) + \"% of its rating. The rating is for the lead, not for each socket.\")\n    print(\"The heat in the lead and its plug goes with the square of the current: \" + hundredths(l[3]) + \" times what it was built to carry.\")\n\ndef show_abroad():\n    w = 2000\n    rated = 240\n    volts = 120\n    ohms = power.half_up(rated * rated * 10, w)\n    print(\"A \" + commas(w) + \" W heater built for \" + str(rated) + \" V is plugged into a \" + str(volts) + \" V supply with a plug adapter. Its element is a fixed resistance, \" + str(int((ohms - ohms % 10) / 10)) + \".\" + str(ohms % 10) + \" ohms.\")\n    print(\"At half the voltage it draws half the current, \" + a1(power.amps_tenths(w, rated)) + \" down to \" + a1(power.amps_tenths(power.watts_at(w, rated, volts), volts)) + \", and gives a quarter of the heat: \" + commas(power.watts_at(w, rated, volts)) + \" W, not \" + commas(int(w / 2)) + \".\")\n\ndef own_plug():\n    t = plain(input(\"appliances by number, e.g. 1 4 5> \"))\n    if t == \"\":\n        print(\"Cancelled.\")\n        return\n    picked = []\n    cur = \"\"\n    ok = True\n    for c in t + \" \":\n        if c == \" \":\n            if cur != \"\":\n                if len(cur) != 1 or not digits(cur) or int(cur) < 1 or int(cur) > len(power.appliances()):\n                    ok = False\n                else:\n                    for p in picked:\n                        if p == int(cur):\n                            ok = False\n                    picked = picked + [int(cur)]\n                cur = \"\"\n        else:\n            cur = cur + c\n    if not ok or len(picked) == 0 or len(picked) > power.sockets():\n        print(\"Type 1 to \" + str(power.sockets()) + \" different numbers from 1 to \" + str(len(power.appliances())) + \", separated by spaces.\")\n        return\n    ws = []\n    names = \"\"\n    for p in picked:\n        a = power.appliances()[p - 1]\n        ws = ws + [a[1]]\n        if names != \"\":\n            names = names + \", \"\n        names = names + a[0]\n    l = load(ws)\n    print(names + \": \" + commas(l[0]) + \" W, \" + a1(l[1]) + \", \" + str(l[2]) + \"% of the rating.\")\n    if l[0] > power.rating() * power.supply():\n        print(\"Over the rating: unplug something before the lead runs hot, at \" + hundredths(l[3]) + \" times the heat it was built for.\")\n    else:\n        print(\"Within the rating.\")\n\ndef number(prompt, lo, hi):\n    t = plain(input(prompt + \" (\" + str(lo) + \" to \" + str(hi) + \")> \"))\n    if t == \"\":\n        print(\"Cancelled.\")\n        return 0 - 1\n    if len(t) > len(str(hi)) or not digits(t) or int(t) < lo or int(t) > hi:\n        print(\"Type a whole number from \" + str(lo) + \" to \" + str(hi) + \".\")\n        return 0 - 1\n    return int(t)\n\ndef own_heater():\n    w = number(\"heater watts\", 100, 3000)\n    if w < 0:\n        return\n    rated = number(\"volts it was built for\", 100, 250)\n    if rated < 0:\n        return\n    volts = number(\"volts of the supply\", 100, 250)\n    if volts < 0:\n        return\n    p = power.watts_at(w, rated, volts)\n    print(\"A \" + commas(w) + \" W heater built for \" + str(rated) + \" V gives \" + commas(p) + \" W on \" + str(volts) + \" V.\")\n    if volts < rated:\n        print(\"Less voltage, and the heat falls with its square.\")\n    elif volts > rated:\n        print(\"More than it was built for: the heat rises with the square of the voltage, past what the element is made to take.\")\n    else:\n        print(\"The voltage it was built for.\")\n\nprint(\"== Power strip ==\")\nprint(\"An extension lead, what shares it, and a heater taken abroad.\")\nrunning = True\nwhile running:\n    print(\"\")\n    print(\"1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\")\n    choice = plain(input(\"choice> \"))\n    if choice == \"1\":\n        show_lead()\n    elif choice == \"2\":\n        show_heaters()\n    elif choice == \"3\":\n        show_abroad()\n    elif choice == \"4\":\n        own_plug()\n    elif choice == \"5\":\n        own_heater()\n    elif choice == \"6\":\n        running = False\n    else:\n        print(\"Pick a number from 1 to 6.\")\nprint(\"Bye.\")\n"
    },
    {
      "name": "power.eml",
      "eml": "# P180 power strip - an extension lead rated 10 A on a 230 V supply, the\n# appliances that might share it, and a heater taken abroad. As in the\n# corpus case each-heater-was-within-the-rating-and-together-they-were-not,\n# the lead's rating is for everything plugged into it at once: currents\n# add. And as in half-the-voltage-was-a-quarter-of-the-heat, a heater is a\n# fixed resistance, so its power goes with the square of the voltage. Currents\n# are kept in tenths of an amp, rounded half-up.\n\ndef supply():\n    return 230\n\ndef rating():\n    # amps the lead is rated for, all sockets together\n    return 10\n\ndef sockets():\n    return 4\n\ndef appliances():\n    # [name, watts on the 230 V supply]\n    return [[\"heater\", 1500], [\"second heater\", 1500], [\"kettle\", 2200], [\"lamp\", 60], [\"laptop\", 65], [\"television\", 110]]\n\ndef half_up(num, den):\n    num * 2 + den => y\n    return int((y - y % (2 * den)) / (2 * den))\n\ndef amps_tenths(watts, volts):\n    return half_up(watts * 10, volts)\n\ndef watts_at(watts, rated, volts):\n    # what a heater of `watts` at `rated` volts gives at `volts`\n    return half_up(watts * volts * volts, rated * rated)\n",
      "python": "def supply():\n    return 230\n\ndef rating():\n    return 10\n\ndef sockets():\n    return 4\n\ndef appliances():\n    return [[\"heater\", 1500], [\"second heater\", 1500], [\"kettle\", 2200], [\"lamp\", 60], [\"laptop\", 65], [\"television\", 110]]\n\ndef half_up(num, den):\n    y = num * 2 + den\n    return int((y - y % (2 * den)) / (2 * den))\n\ndef amps_tenths(watts, volts):\n    return half_up(watts * 10, volts)\n\ndef watts_at(watts, rated, volts):\n    return half_up(watts * volts * volts, rated * rated)\n"
    }
  ],
  "sessions": [
    {
      "name": "bad-input",
      "input": "0\nx\n4\n\n4\n7\n4\n1 1\n4\n1 2 3 4 5\n4\nx\n4\n1,2\n4\n0\n4\n6 5\n5\n\n5\n99\n5\n3001\n5\nx\n5\n2000\n\n5\n2000\n99\n5\n2000\n251\n5\n2000\n240\n\n5\n2000\n240\nx\n5\n100\n250\n100\n6\n",
      "screen": "== Power strip ==\nAn extension lead, what shares it, and a heater taken abroad.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 0\nPick a number from 1 to 6.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> x\nPick a number from 1 to 6.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> \nCancelled.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 7\nType 1 to 4 different numbers from 1 to 6, separated by spaces.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 1 1\nType 1 to 4 different numbers from 1 to 6, separated by spaces.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 1 2 3 4 5\nType 1 to 4 different numbers from 1 to 6, separated by spaces.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> x\nType 1 to 4 different numbers from 1 to 6, separated by spaces.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 1,2\nType 1 to 4 different numbers from 1 to 6, separated by spaces.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 0\nType 1 to 4 different numbers from 1 to 6, separated by spaces.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 6 5\ntelevision, laptop: 175 W, 0.8 A, 8% of the rating.\nWithin the rating.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> \nCancelled.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 99\nType a whole number from 100 to 3000.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 3001\nType a whole number from 100 to 3000.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> x\nType a whole number from 100 to 3000.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 2000\nvolts it was built for (100 to 250)> \nCancelled.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 2000\nvolts it was built for (100 to 250)> 99\nType a whole number from 100 to 250.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 2000\nvolts it was built for (100 to 250)> 251\nType a whole number from 100 to 250.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 2000\nvolts it was built for (100 to 250)> 240\nvolts of the supply (100 to 250)> \nCancelled.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 2000\nvolts it was built for (100 to 250)> 240\nvolts of the supply (100 to 250)> x\nType a whole number from 100 to 250.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 100\nvolts it was built for (100 to 250)> 250\nvolts of the supply (100 to 250)> 100\nA 100 W heater built for 250 V gives 16 W on 100 V.\nLess voltage, and the heat falls with its square.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 6\nBye.\n",
      "interpreter": "equal"
    },
    {
      "name": "basic",
      "input": "1\n2\n3\n4\n1 4 5\n4\n1 3\n4\n1 2 3 4\n5\n2000\n240\n120\n5\n1000\n120\n230\n5\n1500\n230\n230\n6\n",
      "screen": "== Power strip ==\nAn extension lead, what shares it, and a heater taken abroad.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 1\nAn extension lead with 4 sockets, rated 10 A, on a 230 V supply: 2,300 W at most, for all its sockets together.\nAppliances that might share it:\n  1  heater         1,500 W   6.5 A\n  2  second heater  1,500 W   6.5 A\n  3  kettle         2,200 W   9.6 A\n  4  lamp              60 W   0.3 A\n  5  laptop            65 W   0.3 A\n  6  television       110 W   0.5 A\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 2\nTwo heaters of 1,500 W: each draws 6.5 A, well under 10.\nTogether they draw 3,000 W, 13.0 A, on a lead rated 10 A: 130% of its rating. The rating is for the lead, not for each socket.\nThe heat in the lead and its plug goes with the square of the current: 1.70 times what it was built to carry.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 3\nA 2,000 W heater built for 240 V is plugged into a 120 V supply with a plug adapter. Its element is a fixed resistance, 28.8 ohms.\nAt half the voltage it draws half the current, 8.3 A down to 4.2 A, and gives a quarter of the heat: 500 W, not 1,000.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 1 4 5\nheater, lamp, laptop: 1,625 W, 7.1 A, 71% of the rating.\nWithin the rating.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 1 3\nheater, kettle: 3,700 W, 16.1 A, 161% of the rating.\nOver the rating: unplug something before the lead runs hot, at 2.59 times the heat it was built for.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 4\nappliances by number, e.g. 1 4 5> 1 2 3 4\nheater, second heater, kettle, lamp: 5,260 W, 22.9 A, 229% of the rating.\nOver the rating: unplug something before the lead runs hot, at 5.23 times the heat it was built for.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 2000\nvolts it was built for (100 to 250)> 240\nvolts of the supply (100 to 250)> 120\nA 2,000 W heater built for 240 V gives 500 W on 120 V.\nLess voltage, and the heat falls with its square.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 1000\nvolts it was built for (100 to 250)> 120\nvolts of the supply (100 to 250)> 230\nA 1,000 W heater built for 120 V gives 3,674 W on 230 V.\nMore than it was built for: the heat rises with the square of the voltage, past what the element is made to take.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 5\nheater watts (100 to 3000)> 1500\nvolts it was built for (100 to 250)> 230\nvolts of the supply (100 to 250)> 230\nA 1,500 W heater built for 230 V gives 1,500 W on 230 V.\nThe voltage it was built for.\n\n1) the lead  2) two heaters  3) a heater abroad  4) plug in your own  5) a heater of your own  6) quit\nchoice> 6\nBye.\n",
      "interpreter": "equal"
    }
  ],
  "builtOn": [
    {
      "slug": "each-heater-was-within-the-rating-and-together-they-were-not",
      "caseId": "957-each-heater-was-within-the-rating-and-together-they-were-not",
      "title": "Each heater was within the rating and together they were not"
    },
    {
      "slug": "half-the-voltage-was-a-quarter-of-the-heat",
      "caseId": "958-half-the-voltage-was-a-quarter-of-the-heat",
      "title": "Half the voltage was a quarter of the heat"
    }
  ],
  "updated": "2026-10-19"
}
