Sobes.tech
Junior — Senior

Optimization and refactoring of the active users retrieval function

livecode

Task condition

It is necessary to improve the performance and readability of the code.


def get_users():
    result = []
    for user in User.objects.all():
        if user.is_active == True:
            result.append(user)
    return result