- Yield is a keyword that is used like return, except the function will return a generator.
-when you call the function, the code you have written in the function body does not run.
-It return the list object.
program-
#define function
def square():
list=[1,2,3,4]
for i in list:
yield i*i
#First way to call function and print yield value
x=square()
for i in x:
print(i)
#second way to print yield value
print(*square())
1
4
9
16
1 4 9 16