Python පැත්තෙකින් ගැටළු විසඳීමේ මට්ටම 8.4

Задание 1

දී ඇති URL එකක්:

pythonurl = 'http://test.com/dir1/dir2/dir3/page.html';

එයින් ෆෝල්ඩර ලැයිස්තුවක් ලෙස ලබා ගන්න:

python['dir1', 'dir2', 'dir3']
Задание 2

පහත පිරමිඩය මුද්‍රණය කරන්න:

1
22
333
4444
55555
666666
7777777
88888888
999999999
Задание 3

නගර සහ ඒවායේ රටවල් ලැයිස්තුවක් පහත ව්‍යුහයේ ගබඩා කර ඇත:

pythondata = [
  {
    'country': 'country1',
    'city':    'city11',
  },
  {
    'country': 'country2',
    'city':    'city21',
  },
  {
    'country': 'country3',
    'city':    'city31',
  },
  {
    'country': 'country1',
    'city':    'city12',
  },
  {
    'country': 'country1',
    'city':    'city13',
  },
  {
    'country': 'country2',
    'city':    'city22',
  },
  {
    'country': 'country3',
    'city':    'city31',
  },
]

දත්ත ව්‍යුහය මෙයට නැවත සකස් කරන කේතය ලියන්න:

python[
  'country1': {
    'city11', 'city12', 'city13',
  },
  'country2': {
    'city21', 'city22'
  },
  'country3': {
    'city31', 'city32'
  },
]