Niveau 10.8 i Python opgavebog

Задание 1

Skriv kode, der vil kontrollere styrken af en adgangskode. Find selv på kriterierne for styrke.

Задание 2

Givet en liste. Udskriv til konsollen alle mulige permutationer af elementerne i denne liste.

Задание 3

Udskriv en liste over alle venlige tal fra et givet interval.

Задание 4

Antag at en fil indeholder JSON over byer af følgende form:

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

Antag at en fil indeholder JSON over lande af følgende form:

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

Skriv et script, som i stedet for lande vil erstatte dem med deres id:

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