Problems with exercise Ghost Gobble Arcade Game (Pacman)

hi i´ve been trying to understand whats the problem but i dont get it. and the problem is the same in all task.

the code is:
Preformatted text
def eat_ghost(power_pellet_active:bool, touching_ghost:bool) → bool:

if power_pellet_active == True and touching_ghost == True:
    return True and print('the ghost gets eaten (True).')
    
elif power_pellet_active == False and touching_ghost == True:
    return False and print('ghost **does not** get eaten because no power pellet was active')
    
elif power_pellet_active == True and touching_ghost == False:
    return False and print('ghost **does not** get eaten because the player was not touching the ghost.')

Preformatted text
and it past the test 1 and 2

actual_result = eat_ghost(False, True)
error_message = ('Called eat_ghost(False, True).'
                 f'The function returned {actual_result}, but the '
                 f'tests expected that the '
                 'ghost **does not** get eaten because '
                 'no power pellet was active.')

self.assertIs(actual_result, False, msg=error_message)

but the 3rd test shows this:

AssertionError: None is not True : Called eat_ghost(True, True).The function returned None, but the tests expected that the ghost gets eaten (True).

any help or explanaition is welcome

thanks

Your function is returning None.

False and x is the same as x. print() returns None.

1 Like

Thank you for the answer, i thought that you can sent two actions in a return.