Python | sympy.fromiter() method
Last Updated :
19 Jul, 2019
With the help of sympy.fromiter()
method, we can iterate over the loop and can add elements in tuples and list by using sympy.fromiter()
method.
Syntax : sympy.fromiter()
Return : Return the elements from iteration.
Example #1 :
In this example we can see that by using sympy.fromiter()
method, we are able to iterate over loop and can add elements in tuples and list.
from sympy import *
gfg = Tuple .fromiter(i for i in range ( 6 ))
print (gfg)
|
Output :
(0, 1, 2, 3, 4, 5)
Example #2 :
from sympy import *
gfg = List .fromiter(i for i in range ( 10 ))
print (gfg)
|
Output :
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Share your thoughts in the comments
Please Login to comment...