Niveau 10.8 Python takenboek

Задание 1

Schrijf code die de complexiteit van een wachtwoord controleert. Bedenk zelf criteria voor complexiteit.

Задание 2

Gegeven een lijst. Print alle permutaties van de elementen van deze lijst naar de console.

Задание 3

Print een lijst van alle bevriende getallen uit een opgegeven bereik.

Задание 4

Stel dat in een bestand JSON van steden van het volgende formaat wordt opgeslagen:

cities.json{
  [
    "id": "1",
    "city": "city1",
    "country": "country1",
  ],
  [
    "id": "2",
    "city": "city2",
    "country": "country1",
  ],
  [
    "id": "3",
    "city": "city3",
    "country": "country2",
  ]
}

Stel dat in een bestand JSON van landen van het volgende formaat wordt opgeslagen:

countries.json{
  [
    "id": "1",
    "country": "country1",
  ],
  [
    "id": "2",
    "country": "country2",
  ],
  [
    "id": "3",
    "country": "country3",
  ]
}

Schrijf een script dat in plaats van de landen hun id invult:

cities.json{
  [
    "id": "1",
    "city": "city1",
    "country_id": "1",
  ],
  [
    "id": "2",
    "city": "city2",
    "country_id": "1",
  ],
  [
    "id": "3",
    "city": "city3",
    "country_id": "2",
  ]
}