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!
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
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!')
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")
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)
Great explanation sir.. Take a bow..❤ I want to learn OOPS in python from you.. could you please make videos on it..
Best teacher i found on you tube ❤❤
Nice video sir, while else was confusing at first but understood it after I watched it multiple times. Thanks sir
Thank your for the video!
I am currently learning in my college c++ and python from u
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!
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
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
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!')
without if u can't use else
Thank you sir
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")
that's wrong
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)
When are you planing of making videos on Object Oriented Programing in Python
Thank You
sir ekse aage ka video kha h sir ji
plz upload this
First to watch, comment
Geo g 😂 o yar tu bi