Skip to content

Checking if key is in list #24

Description

@PetrG7

Hello
I would like to make a simple grab keys python3 script, that gets the keys and then checks the list if there is a key or not and then returns an array. I tried this:
#Takes string returns array! def keys_to_array(key): if key == "w": return [0, 1, 0] elif key == "a": return [1, 0, 0] elif key == "d": return [0, 0, 1] else: return "Not working as supposed or None!"

Please help it is not working as supposed and returning Not working as supposed or None!. I suppose there is a problem that the key that is returning is not a string but NoneType. But i dont know

Petr Gardas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions