'what it is an iterable of floats/complex numbers?
I am someone who is learning manim in a self-taught way but I have come across the term "iterable of floats/complex numbers" in the "get_coordinate_labels" method of the class ComplexPlane.
The description of the method says the following:
Parameters
- numbers (Iterable[float | complex]) – An iterable of floats/complex numbers. Floats are positioned along the x-axis, complex numbers along the y-axis.
- kwargs – Additional arguments to be passed to get_number_mobject(), i.e. DecimalNumber.
and I don't understand what you mean by an iterable of floats/complex numbers because my knowledge in python is not very advanced and I am completely unaware of the term Iterable because I have tried with a list and when executing the program I get an error.
I hope you can guide me with an example and thank you very much.
I hope to generate the coordinates of the complex plane with the method get_coordinate_labels
Solution 1:[1]
An Iterable is an object that can be iterated over, such as a list or tuple. So, an iterable of floats or complex numbers is some collection of floats or complex numbers that you can iterate over with, for example, a for loop.
See also: https://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/Iterables.html
More information on complex numbers in Python (in case you're not familiar): https://www.tutorialspoint.com/complex-numbers-in-python
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | EJoshuaS - Stand with Ukraine |
