while Loop with else in Python

Поделиться
HTML-код
  • Опубликовано: 16 ноя 2024

Комментарии • 17

  • @alisheik3076
    @alisheik3076 6 месяцев назад +3

    Great explanation sir.. Take a bow..❤ I want to learn OOPS in python from you.. could you please make videos on it..

  • @HarsitVerma-yt2ce
    @HarsitVerma-yt2ce 2 месяца назад

    Best teacher i found on you tube ❤❤

  • @yatinshekhar787
    @yatinshekhar787 9 месяцев назад

    Nice video sir, while else was confusing at first but understood it after I watched it multiple times. Thanks sir

  • @PremKumar.S-it8et
    @PremKumar.S-it8et Год назад +3

    Thank your for the video!
    I am currently learning in my college c++ and python from u

  • @venkatraman_padmanaban
    @venkatraman_padmanaban 9 месяцев назад

    I have actually had the program question and tried to write my own code. Below is my code:
    fruits = ['orange','banana','mango','orange']
    i = 0
    length = len(fruits)
    temp = 0
    #print(length)
    while i < length:
    if fruits[i] == 'orange':
    temp = 1
    i += 1
    else:
    if temp == 0:
    print("Orange is not present in the list")
    else:
    print("Orange is present in the list")
    But, I was really amazed of seeing how while with else has reduce the lines of code and our pain too!!!
    Thank you very much for this useful content!

  • @kaneki3194
    @kaneki3194 11 месяцев назад +1

    Please notice me sir! I really love your explanation. You really elaborated kt clearly to the point that event a monkey like me ca understand. This video helped me understand about while loops and its concept. So I thank you

    • @ericsiboniso
      @ericsiboniso 8 месяцев назад

      youre not a monkey . if you were you wouldnt have the strength to study python youre much more than that and youre smarter than you think

  • @tayyab.sheikh
    @tayyab.sheikh 4 месяца назад +2

    can't we write it like this:
    fruits = ['apple', 'banana', 'mango', 'strawberry', 'orange']
    while 'orange' in fruits:
    print ('Orange is available')
    break
    else:
    print ('Orange is not available!')

  • @NSHIMIYIMANAAMOS-yi9hs
    @NSHIMIYIMANAAMOS-yi9hs Год назад +1

    Thank you sir

  • @isaacodunaike6978
    @isaacodunaike6978 2 месяца назад

    teacher what of using this way to solve the question?
    fruits = ["apple", "banana", "mango", "strawberry"]
    while "orange" in fruits:
    print(True)
    break
    else:
    print("False")

    • @C_H_R_O_L_L_O
      @C_H_R_O_L_L_O Месяц назад

      that's wrong

    • @C_H_R_O_L_L_O
      @C_H_R_O_L_L_O Месяц назад +1

      if you wanna search a element in a list you can use count method or use indexing
      fruits=["apple", "banana", "mango", "berry"]
      length=len(fruits)
      for i in range(0,length-1):
      if fruits[i]=="orange":
      print("true")
      break
      else:
      print(false)

  • @tonykay07
    @tonykay07 Год назад

    When are you planing of making videos on Object Oriented Programing in Python
    Thank You

  • @thirdeyegaming4310
    @thirdeyegaming4310 Год назад

    sir ekse aage ka video kha h sir ji
    plz upload this

  • @masteragentonly
    @masteragentonly Год назад

    First to watch, comment