What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-19 14:00:02
python defining the iterator protocol
class RangeTen: def __init__(self, *args): pass # optional def __iter__(self): '''Initialize the iterator.''' self.count = -1 return self def __next__(self): '''Called for each iteration. Raise StopIteration when done.''' if... Add solution -
Python 2021-11-22 03:13:14
python exception list
AssertionError #Raised when assert statement fails. AttributeError #Raised when attribute assignment or reference fails. EOFError #Raised when the input() functions hits end-of-file condition. FloatingPointError #Raised when a floating point opera... Add solution -
Python 2021-11-10 01:04:13
exception types python
AssertionError #Raised when assert statement fails. AttributeError #Raised when attribute assignment or reference fails. EOFError #Raised when the input() functions hits end-of-file condition. FloatingPointError #Raised when a floating point opera... Add solution -
Python 2021-09-10 14:59:02
stopiteration error python
# When an iterator is done, it’s next method raises StopIteration. This exception is # not considered an error. We re-write the given code as follows to catch the # exception and know its type. Example import sys try: z = [5, 9, 7] i = iter(z) pr... Add solution
Best helpers
Rlw
+5
John Rualo
+5
Michael Wang
+5
Heavens
+5
Calvino
+5
Withparadox2
+5
Avocado
+5
SuzyTypehead
+5
Aj Morales
+5