{
  "format": "tokbit",
  "version": 1,
  "name": "Finding a name",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "names",
      "type": "list[str]",
      "init": "[\"Adam\", \"Beth\", \"Carl\", \"Dana\", \"Eva\"]"
    },
    {
      "id": "u2",
      "kind": "declare",
      "name": "target",
      "type": "str"
    },
    {
      "id": "u3",
      "kind": "declare",
      "name": "position",
      "type": "int",
      "init": "-1"
    },
    {
      "id": "u4",
      "kind": "declare",
      "name": "i",
      "type": "int",
      "init": "0"
    },
    {
      "id": "u5",
      "kind": "output",
      "values": "\"Class:\", names"
    },
    {
      "id": "u6",
      "kind": "input",
      "target": "target",
      "prompt": "Who are you looking for?",
      "comment": "The variable is text, not a number."
    },
    {
      "id": "u7",
      "kind": "while",
      "condition": "i < len(names) and position == -1",
      "body": [
        {
          "id": "u8",
          "kind": "if",
          "condition": "names[i] == target",
          "then": [
            {
              "id": "u9",
              "kind": "assign",
              "target": "position",
              "value": "i"
            }
          ],
          "else": []
        },
        {
          "id": "u10",
          "kind": "assign",
          "target": "i",
          "value": "i + 1"
        }
      ]
    },
    {
      "id": "u11",
      "kind": "if",
      "condition": "position == -1",
      "then": [
        {
          "id": "u12",
          "kind": "output",
          "values": "target, \"is not in the class.\""
        }
      ],
      "else": [
        {
          "id": "u13",
          "kind": "output",
          "values": "target, \"is at position\", position"
        }
      ]
    }
  ],
  "functions": [],
  "comment": "Solution to the task “Finding a name”: Change the program to search for names in a class (a list of texts). What else do you need to change besides the list?",
  "screen": "fit"
}
