The if-elif-else Statement in Python

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 26

  • @Freefireboy-j4x
    @Freefireboy-j4x Місяць тому +8

    I am in 8th grade and tomorrow is my practical test of computer.....You helped me so much 🙏

    • @SuribhaiMinecraft
      @SuribhaiMinecraft 25 днів тому +1

      I am also in class 8th may u have good luck for that day

    • @Freefireboy-j4x
      @Freefireboy-j4x 25 днів тому

      @SuribhaiMinecraft yep...I scored full marks in my practical test. THANKS 😊 FOR YOUR support 🙏

  • @jatin607
    @jatin607 Рік тому +5

    Sir why are you left the Java playlist incomplete. Sir you are making so much efforts to make the video and we students are also look for the content which is completed.kindly upload the remaining video of Java playlist

  • @leealvin7671
    @leealvin7671 Рік тому +16

    Let’s take n = 6
    n = 6
    if n % 2 == 0:
    print(“Number is divisible by 2”)
    elif n % 3 == 0:
    print(“Number is divisible by 3”)
    else:
    print(“Number is neither divisible by 2 nor 3”)
    print(“Done!”)
    The output will be:
    Number is divisible by 2
    Done!
    Why is it though, even though 6 can also be divisible by 3
    Reason: Since the first condition is satisfied, Python interpreter wouldn’t consider the second condition onwards and will continue after exiting the if-elif-else statement.
    Improvement:
    n = 6
    if n % 2 == 0 & n % 3 == 0:
    print(“Number is divisible by 2 and 3”)
    elif n % 2 == 0:
    print(“Number is divisible by 2”)
    elif n % 3 == 0:
    print(“Number is divisible by 3”)
    else:
    print(“Number is neither divisible by 2 nor 3”)
    print(“Done!”)
    By adding a line of code, you may get the desired output
    Output:
    Number is divisible by 2 and 3
    Done!

    • @doctorbongumusa1566
      @doctorbongumusa1566 4 місяці тому

      python does not allow & unless you use ("&") it will then identify it as a string but will result in a syntax error

  • @shivamchakrawarti8262
    @shivamchakrawarti8262 Рік тому +2

    Great lecture sir if it is possible then please upload these lectures per day so that we remain consistent..

  • @RealRadaiZabala
    @RealRadaiZabala 11 місяців тому

    You are a great teacher, thank you very much... @Neso Academy

  • @daregamerboy2255
    @daregamerboy2255 Рік тому +3

    Thank u for your effort sir 🙏

  • @SushilaMeena-1804
    @SushilaMeena-1804 Рік тому +2

    Today's i perform this code in my lab but I can't understand but now my concept clear😊😊

  • @studentgroup1017
    @studentgroup1017 Рік тому +1

    Thank you for Amazing Python course,
    Tottle how many videos are there of this course. Please replay

  • @alexjrmatta
    @alexjrmatta Місяць тому

    Excelente video !❤❤🎉🎉

  • @hadi1725
    @hadi1725 5 днів тому

    thank u for ur hard work

  • @kristinamwangekan2471
    @kristinamwangekan2471 Рік тому +1

    Thank you...well explained

  • @chandraj1053
    @chandraj1053 9 місяців тому

    Good explanation sir

  • @PacifistNihilist
    @PacifistNihilist 3 місяці тому

    Thank you for the explanation. Also thank you for explaining what WAP meant because I had something totally different in mind 😂

  • @adikwusunday3907
    @adikwusunday3907 2 місяці тому

    Very well lecture.

  • @kajalHere-r1d
    @kajalHere-r1d 4 місяці тому

    thankyou for this ...

  • @GousyaShaik-bq3xy
    @GousyaShaik-bq3xy Рік тому

    Happy teacher's day sir😅

  • @MaTHNERVEs
    @MaTHNERVEs 7 місяців тому

    How can i get pdf of class. I need this. My exam is knocking doors

  • @zaki695
    @zaki695 Рік тому

    Thank you sir

  • @lawrenceoko1783
    @lawrenceoko1783 4 місяці тому

    Great

  • @TheZentleMan
    @TheZentleMan 9 місяців тому

    Must run it 😂😅
    print("Do you want to know what you were in a past life?")
    while True:
    a=input("enter 'yes' or 'no' to continue :")
    if a=="yes":
    print("
    Chutiya thhe tum!")
    break
    elif a=="no":
    print("
    toh bhaad mein jao phir! ")
    break
    else:
    print("
    PLEASE ENTER ONLY 'yes' or 'no'
    ")

  • @GitaAska-is6yz
    @GitaAska-is6yz 7 місяців тому

    Tutorial python tricks and modifications

  • @DEWAAN-ud7ss
    @DEWAAN-ud7ss Рік тому

    Thank you sir