Комментарии:
Im sorry to say your explanation is becoming staler and actually complicates the concepts,for the last 3 videos including this one .i had to go to another video and learn it and comeback here.i hope i don't have to do that every video from now on
ОтветитьThere was an indentation error at return val thats why its repeating., remove 1 space before return.
Ответитьnice video
ОтветитьWhere are you from?
Ответитьshikhar dhawan op
ОтветитьGood
Ответитьhow many of you went back video and see he have mustache(search meaning in google) of our teacher 😂🤣🤣
ОтветитьIf you want to work the loop for multiple times put "self.num = 1" in else condition.
ОтветитьExcellent video! Thank you
Ответитьwe are hearing to learn, not checking your talent.
ОтветитьIf you type
print(next(values))
after the for loop, you will get an Error.
pythoooooooooonnnn
Ответитьi geniunly have a hatred toward people using light mode
ОтветитьFinally I got this yayyyyy
Ответитьbakwas
ОтветитьI like your moustache
ОтветитьI'm not an alien, thus, I'll always skip the first 10 sec of your videos.
ОтветитьSir,
Why can't we use break in else part to stop the execution of for loop ?
sir could you please suggest me a source from where i can practice python, please!!
ОтветитьI still can't seem to comprehend the word iterate, aswell when he says it 'loops' over. I would really appreciate if anyone could dumb down the explanation as much as possible I'm desperate to understand this concept lol. Thank you in advance
ОтветитьBy this way are v overloading the Iter & next inbuilt function ?
ОтветитьMota badu
ОтветитьThank you Mr. Reddy!
Ответитьdef __iter__(self):
return self
What is the reason of using it? Can anyone explain?
If something is returned in a function it return value to function call right ? What is happening to return here. Object is being returned......
Ответитьthe answer is:
1
2
3
4
5
6
7
8
9
10
since we already have for loop to iterate the list then why are we making things more complex by making this iterator
Ответить'1' will be printed twice as the 'for loop' always starts from the 1st element in the list. so both are different things and it will give the twice ones then will continue up to what we want to print.
ОтветитьThe raise keyword is used to raise an exception. You can define what kind of error to raise(here its StopIteration).
Ответитьafter a long time i have seen your mustache
Ответитьsame value
Ответитьtq
Ответитьplease make series on python turtle
Ответитьhiii bro, create the own class that not repeat again values...but inbuild the value or nums it can repeating ....i wanna clear about it this video
ОтветитьWhat does that __iter__() method do here sir
Ответитьcan we use break instead of "raise stop iteration"
Ответитьwhy even without calling iter and next methods they are running
Ответитьlooking handsome
ОтветитьThank you Mr. Navin !
ОтветитьIn pycharm you can use (control + d) to copy the line and paste it onto the next in the place of using (ctrl + c) and (ctrl + v).
ОтветитьTo be honest i understood this better from u sir in comparison to code with harry ,i m not comparing but actually u r a little better in explaining , don't kill me code with harry fans i am also his fan it's just my opinion
Ответитьprint statement prints 1 and the for loop prints 2, 3, 4,..., 10
ОтветитьIt will give all ten value once
ОтветитьBhaya samajh ni aya
Ответитьwow you really explain well and are one of the few indians that have no accent almost respect
ОтветитьThe when you say Iterators. How cool is that..
Ответитьclass TopTen:
def __init__(self):
self.num=1
def __iter__(self):
return self
def __next__(self):
val=self.num
self.num += 1
return val
values = TopTen()
for i in values:
print(i)
------------
i'm getting error like: TypeError: 'TopTen' object is not iterable
------------
Could'u help me to fix this ?
I'm confused. Couldn't we just print "nums" to output the values? Why did we need a "for" statement to display all 4 values?
ОтветитьDil se dhanywaad🙏✌️🤗
Ответить