Niveau 10.8 i Python opgavebog
Skriv kode, der vil kontrollere styrken af en adgangskode. Find selv på kriterierne for styrke.
Givet en liste. Udskriv til konsollen alle mulige permutationer af elementerne i denne liste.
Udskriv en liste over alle venlige tal fra et givet interval.
Antag at en fil indeholder JSON over byer af følgende form:
{
[
"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:
{
[
"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:
{
[
"id": "1",
"city": "city1",
"country_id": "1",
],
[
"id": "2",
"city": "city2",
"country_id": "1",
],
[
"id": "3",
"city": "city3",
"country_id": "2",
]
}