User FAQs


1) What is the difference between a list and a tuple ?
Lists have square brackets [] and are mutable (can be modified)
Tuples have normal brackets () and are immutable (cannot be modified)



2) What are Dict and List comprehensions ?
These allow for multiple iterators and can be used to combine multiple lists into one



3) What is a Negative Index ?
Negative numbers mean that you count from the right instead of the left.
So, list[-1] refers to the last element, list[-2] is the second-last, and so on.



4) What is an iterator ?
An iterator is an object that contains a countable number of values.
An iterator is an object that can be iterated upon, meaning that you can traverse through all the values.
Technically, in Python, an iterator is an object which implements the iterator protocol, which consist of the methods __iter__() and __next__().



5) What are Generators ?
the generator is a way that specifies how to implement iterators. It is a normal function except that it yields expression in the function. It does not implement __itr__ and __next__ method and reduces other overheads as well.
If a function contains at least a yield statement, it becomes a generator. The yield keyword pauses the current execution by saving its states and then resumes from the same when required.


6) What is the difference between a list and an array ?
Arrays can only contain values that are the same data type
Lists can contain mixed data types


7) How can I define a 1-dimensional array ?
["this",1,"is","an","array"]


8) How can I define a 2-dimensional array ?



© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext