Hi I am getting this error to checking the positive value check in the tuple, i am getting this error
my_tuple = []
a=(5,6)
b=(8,9)
#print("The list is :")
my_tuple.append((a,b))
#print(my_tuple)
my_result = [sub for sub in my_tuple[0] if all(element >= 0 for element in sub)]
print(len(my_result))
#print("The result is :")
#print(my_result)
CodePudding user response:
If you uncomment all of the commented-out lines, your code runs fine with the following output:
The list is :
[((5, 6), (8, 9))]
2
The result is :
[(5, 6), (8, 9)]