Tasavvur qiling bizda quyidagicha foydalanuvchilar ro'yxati mavjud:

users = [
     {
         'id': 1,
         'name': 'Azamat',
         'lastname': 'Yaxyoyev',
         'interests': ['coding', 'gaming', 'reading'],
         ('adress', 'bank_info'): {
             'adress': 'Tashkent',
             'bank_info': 'Ipak yuli'
         }
     },
     {
         'id': 2,
         'name': 'Sardor',
         'lastname': 'Mirzayev',
         'interests': ['coding', 'reading', 'driving'],
         ('adress', 'bank_info'): {
             'adress': 'Jizzax',
             'bank_info': 'Aloqa bank'
         }
     },
     {
         'id': 3,
         'name': 'Shovkat',
         'lastname': 'Aminov',
         'interests': ['listening', 'shopping', 'writing'],
         ('adress', 'bank_info'): {
             'adress': 'Kashkadarya',
             'bank_info': 'OFB'
         }
     },
 ]

Va bizda quyidagi baholar ro'yxati mavjud:

 marks = {
     1: {
         'python': 5,
         'c++': 4
     },
     2: {
         'python': 3,
         'c++': 3
     },
     3: {
         'python': 2,
         'c++': 2
     },
 }

Endi for sikli yordamida foydalanuvchilar(users) ro'yxatiga murojaat qilamiz

 for user in users:
      print(user)

So'ngra, har bir elmentdagi kalitlar va qiymatlarni aniqlab olamiz,

     for key, value in user.items():
         print(key, value)

Shart operatorlari yordamida element qiymati ro'yxat(list) bo'lgan taqdirda kalitlar(key)ni chiqarib olamiz

         if type(value) is list:
              print(f"--- {key}")

Qiymat ichidagi elementlarni chiqaramiz

             for item in value:
                  print(f'--{item}')

Keyingi shartlarni tekshirib kalit va qiymatlarni chiqaramiz, agar qiymat turi 'lugat'(dictionary) bo'lsa kalit va qiymatni alohida chiqaramiz

         elif type(value) is dict:
             # print(f'-{key}')
             for k, v in value.items():
                 pass
                 # print(f'----{k}: {v}')

         elif type(value) is int:
             print(key, value)
             for course, mark in marks[value].items():
                 print(f'---{course}: {mark}')
         else:
             print(key, value)

Va bizda natija ajoyib har bir 'id' dagi o'quvchi va uning baholari haqida ma'lumot:

id 1
---python:5
---c++:4
name:Azamat
lastname:Yaxyoyev
----interests----
coding
gaming
reading
('addres', 'bank_info')
addres:Tashkent
bank_info:Ipak yuli
id 2
---python:4
---c++:3
name:Sardor
lastname:Mirzayev
----interests----
coding
reading
driving
('addres', 'bank_info')
addres:Jizzakh
bank_info:Aloqabank
id 3
---python:3
---c++:2
name:Ruslan
lastname:Aminov
----interests----
listening
coding
shopping
('addres', 'bank_info')
addres:Sirdarya
bank_info:Ipotekabank