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