What is iterable object I need deep explain please? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is iterable object I need deep explain please?

I was really confusing about iterable object please some one help

10th Dec 2020, 8:38 AM
Antony Praveenkumar M
Antony Praveenkumar M - avatar
1 Answer
+ 2
to iterate means to "so something again" think of the word "reiterate". now an iterable is something that is iterated over, basically like lists or tuples but it can include dictionaries and really anything where a process is repeated. for example, if you have a list [1.2.3] you can iterate over this list using a "plus 5" operation so that the list becomes [6,7,8] this is contrasted with regression which is where something is done in kind of a backwards and horrifying way that is really hard to explain but you know it when you see it, it is a more advanced topic. you'll get it eventually. lambdas are a single line function. in our example you could make a lambda function for the "plus five" operation and feeding it the list [1,2,3] by saying a = lambda x: x+5 print(a([1,2,3]])) ----> [6,7,8] I assigned the lambda function to a variable but you can also use it deeper in the code which is much more helpful. as you can see lambdas do not include a return or def statement. they are much more concise. here the lambda function iterated over the list producing a new output. hope this helped, it may not be what you were looking for but if you have any questions i will try my best to answer
11th Dec 2020, 7:45 AM
madeline
madeline - avatar