Regarding yield working

def print_even(test_list) :
for i in test_list:
if i % 2 == 0:
yield i
print(“hello”)

initializing list

test_list = [1, 4, 5, 6, 7]

printing initial list

print ("The original list is : " + str(test_list))

printing even numbers

print ("The even numbers in list are : ", end = " ")
for j in print_even(test_list):
print (j, end = " ")
#print(j)
if j==6:
break

Why is hello after 6 is not printed? Why is the function not executed fully in case of 6?

@saksham_105
Cannot understand your code since the indentation is all messed up as you copy pasted it as text.
Save your code at cb.lk/ide and share the link here.