Nivå 10.8 Python oppgavebok

Задание 1

Skriv kode som vil sjekke passordets styrke. Kom med egne kriterier for styrke.

Задание 2

Gitt en liste. Skriv ut i konsollen alle variantene av permutasjoner av elementene i denne listen.

Задание 3

Skriv ut en liste over alle vennlige tall fra et gitt intervall.

Задание 4

Anta at en fil lagrer JSON for byer av følgende type:

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

Anta at en fil lagrer JSON for land av følgende type:

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

Skriv et skript som i stedet for land 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",
  ]
}