Quizzma Latest Questions

It’s a bird! It’s a plane! No, it’s Superman! Which is the correct implementation of is_superman?

“It’s a bird! It’s a plane! No, it’s Superman!” We want to write a function is_superman that takes in two parameters is_bird and is_plane and returns True if it is in fact Superman, and False otherwise. If it’s not a bird and it’s not a plane, it must be Superman. Which of the following functions is the correct implementation of is_superman?

def is_superman(is_bird, is_plane):
return is_bird or is_plane

def is_superman(is_bird, is_plane):
return not is_bird or not is_plane

def is_superman(is_bird, is_plane):
return not is_bird and not is_plane

def is_superman(is_bird, is_plane):
return is_bird and is_plane




Leave an answer

Leave an answer

1 Answer

  1. The correct implementation of `is_superman` is:

    
    

    def is_superman(is_bird, is_plane):

    return not is_bird and not is_plane

    ### Explanation:

    In this function, we check if something is neither a bird nor a plane. According to the statement, if it is not a bird and it is not a plane, then it must be Superman. Hence, we use `not is_bird and not is_plane` to return `True` only when both conditions are met.

Related Questions