Vlak 10.8 van Python Probleemoplossingsboek
Skryf 'n kode wat die kompleksiteit van 'n wagwoord sal nagaan. Bedink jou eie kriteria vir kompleksiteit.
Gegee 'n lys. Druk alle moontlike permutasies van elemente in hierdie lys na die konsole.
Druk 'n lys van alle bevriende getalle van 'n gegewe reeks.
Aanvaar dat 'n lêer JSON-data van stede van die volgende vorm bevat:
{
[
"id": "1",
"city": "city1",
"country": "country1",
],
[
"id": "2",
"city": "city2",
"country": "country1",
],
[
"id": "3",
"city": "city3",
"country": "country2",
]
}
Aanvaar dat 'n lêer JSON-data van lande van die volgende vorm bevat:
{
[
"id": "1",
"country": "country1",
],
[
"id": "2",
"country": "country2",
],
[
"id": "3",
"country": "country3",
]
}
Skryf 'n skrip wat die lande sal vervang
met hul id:
{
[
"id": "1",
"city": "city1",
"country_id": "1",
],
[
"id": "2",
"city": "city2",
"country_id": "1",
],
[
"id": "3",
"city": "city3",
"country_id": "2",
]
}