lesson5


Another thing to keep in mind is that while multiple returns are possible, they're generally frowned upon. See if you can capture your return in a variable and return only once. Also try not to duplicate your tests. You've tested for bvalue twice (the first and third statements), and you've also tested for short twice. Instead of:

    if x and a:
        ...
    elif x and b:
        ...
    elif y and a:
        ...
    else:

You could use two different ifs:

    if x:
        ...
    else:
        ...

    if a:
        ...
    else:
        ...

I can also see that you've made a small syntactic problem that lint will call you on regarding equality vs. identity for booleans. Since True and False are constants and exist only once, you should never use equality (`==`) to check their value, preferring instead either `is` or just directly checking, eg, if `bvalue` is a boolean:

    if bvalue:
        # do something

This works because all `is` or `==` or any other test returns is a boolean `True`/`False`. So if you already have a boolean, let the `if` read that instead of going to the extra work of checking the value.