Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114
Python İç İçe if Deyimleri - Nested if Statements - RAGIP ÜNAL

Blog

Python İç İçe if Deyimleri – Nested if Statements

Tek bir if deyimi programın iki seçenekten birini seçmesine olanak sağlar. Fakat birçok pratik uygulamada tek bir if deyimi yetersiz kalır. Birinci kararın alındıktan sonra ikinci ve hatta üçüncü kararın alınması gerekebilir. Bu tarz bir akışı iç içe if deyimleri ile yönetebiliriz.

Bu durumu daha iyi izah edebilmek için aşağıda yazmış olduğum üç tam sayıdan en küçüğünün bulunması örneğini inceleyelim.

a=input("BİRİNCİ TAMSAYI, A...")
a=int(a)
b=input("İKİNCİ TAMSAYI, B...")
b=int(b)
c=input("ÜÇÜNCÜ TAMSAYI, C...")
c=int(c)
if a<b:
    if a<c:
        print("En Küçük Sayı A", a)
    else:
        print("En Küçük Sayı C", c)
elif b<c:
    print("En Küçük Sayı B", b)
else:
    print("En Küçük Sayı C", c)

Programı çalıştırdığımızda aşağıdaki sonuç aşağıdaki gibidir.

BİRİNCİ TAMSAYI, A...5
İKİNCİ TAMSAYI, B...8
ÜÇÜNCÜ TAMSAYI, C...3
En Küçük Sayı C 3
>>> 

005_if_elif_else.py

Leave A Comment

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir