v2.5.2
Giriş yap

Burada bazı kısımlar kafamı karıştırıyor

rufiqcavadov
99 defa görüntülendi

Merhaba. Aşağıda verdiğim kodu videolu bana anlatabilir misiniz rica etsem ya da Discord sunucusunda bir şekilde ekran paylaşıp gösterebilir misiniz?

products = [
    Product(1, 'iPhone 13', 1500, 20, '2024-04-22', False),
    Product(2, 'iPhone 14', 1500, 20, '2024-04-22', False),
    Product(3, 'iPhone 15', 1500, 20, '2024-04-22', False),
    Product(4, 'iPhone 15 Pro Plus', 1500, 20, '2024-04-22', True),
    Product(5, 'iPhone 15 Pro Plus', 1500, 20, '2024-04-22', False)
]

def find_active_products(products):
    active_products = []
    inactive_products = []
    
    for product in products:
        if product.Status:
            active_products.append(product)
        else:
            inactive_products.append(product)
    
    if active_products:
        return active_products
    else:
        return False

result = find_active_products(products)

if result:
    for product in result:
        print(product.Name)
else:
    print('There are no active products.')
    ```
Cevap yaz
Cevaplar (0)
Henüz kimse cevap yazmadı. İlk cevap yazan sen ol!