GoogleAdsense

14 Haziran 2021 Pazartesi

Python Lesson 08-IF_Elif_Else.

 https://github.com/Albatros46/PythonLesson2/blob/main/D08-IF_Elif_Else.py

age=17
print("------------------------------------------------------------")
if age >=18:
    print(f'Yasiniz {age} Oy kullanabilirsiniz')
else:
    print(f"Yasiniz {age} oy Kullanamazsiniz")
print("------------------------------------------------------------")
#----------------------------------------------------------
# elif -> else if kisaltmasidir bir den cok kiyaslama varsa kullanilir.
if age <=15
    print("% 50 indirimli")
elif age<=20:
    print("% 20 indirimli")
else:
    print("inirim mindirim yok!..")
#--------------------------------------------------------------------
print("------------------------------------------------------------")
sonuc=10
durum =False 
harfnot=" "

if sonuc<=20:
     harfnot="FF"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=30:
     harfnot="FD"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=40:
     harfnot="DD"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=50:
     harfnot="DC"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=60:
     harfnot="CC"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=70:
     harfnot="CB"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=80:
     harfnot="BB"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc<=90:
     harfnot="BA"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
elif sonuc == (91 or 100):
     harfnot="BA"
     print(f"{sonuc} oldugu icin harf notunuz {harfnot}")
else:
     print("Hatali Not Girdiniz!")

if harfnot==("FF" or "FD"):
    durum=False
    print(f"{sonuc} oldugu icin harf notunuz {harfnot} KALDINIZ")
else:
    durum=True
    print(f"{sonuc} oldugu icin harf notunuz {harfnot} GECTINIZ")
print("------------------------------------------------------------")

Hiç yorum yok:

Yorum Gönder

Python Lesson 13-Object_Oriented_1

  Python Lesson 13-Object_Oriented_1 #Nesne Yönelimli Python I, Nesne, Sınıf class   Car :  #araba class olusturuldu      pass car_1 = Car (...