{
  "format": "tokbit",
  "version": 1,
  "name": "Position of the largest",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "numbers",
      "type": "list[int]",
      "init": "[3, 17, 5, 12, 9]"
    },
    {
      "id": "u2",
      "kind": "declare",
      "name": "largest",
      "type": "int",
      "init": "numbers[0]"
    },
    {
      "id": "u3",
      "kind": "declare",
      "name": "position",
      "type": "int",
      "init": "0",
      "comment": "It also remembers the index where it found the maximum."
    },
    {
      "id": "u4",
      "kind": "for",
      "variable": "i",
      "range": "1, len(numbers)",
      "body": [
        {
          "id": "u5",
          "kind": "if",
          "condition": "numbers[i] > largest",
          "then": [
            {
              "id": "u6",
              "kind": "assign",
              "target": "largest",
              "value": "numbers[i]"
            },
            {
              "id": "u7",
              "kind": "assign",
              "target": "position",
              "value": "i"
            }
          ],
          "else": []
        }
      ]
    },
    {
      "id": "u8",
      "kind": "output",
      "values": "\"The largest number is\", largest, \"at position\", position"
    }
  ],
  "functions": [],
  "comment": "Solution to the task “Where is the largest”: Also print the position of the largest number in the list (counting from 0). What extra does the program have to remember?"
}
