how do i get the if statement to print a value inside an array?

Try with in instead of ==,

array = [1, 2]

one = 1
two = 2

def trying():
    if one in array:
        print("This Works")

print(trying())

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top