Q:

How do I check if a tuple is only made up of two numbers?

I'm trying to make a function that makes sure that my tuple is only made up of zeros or ones.
def zero_um(maze):
    for i in range(len(maze)):
        if maze[i]==0 and maze[i]==1:
                return True
            else:
                return False

However this will always lead to false because a numer can't be one and zero at the same time.
But if i try:
def zero_um(tpl):
    for i in range(len(tpl)):
        if tpl[i]==0 or tpl[i]==1:
                return True
            else:
                return False

but that accepts asnwers like (1,2)
I've also tried with using != but ran into similar dilemas

A:

Iterate over each value in the tuple, and if it is not 0 or 1, return False.
for value in mytuple:
    if value not in [0,1]:
        return False
return True

A:

You can use set(maze) <= {0, 1}.
By the way returning True or False in if branches is never a good idiom since you can just return the expression itself:
return set(maze) <= {0, 1}

instead of
if set(maze) <= {0, 1}:
    return True
else:
    return False

