Which fix removes the bug?
if 'admin' or 'root' in roles:
grant()
- Group it:
('admin' or 'root') in roles - Use
andinstead oforbetween them - Test each:
'admin' in roles or 'root' in roles - Call
roles.contains('admin', 'root')on the list
It parses as 'admin' or ('root' in roles), and the non-empty string 'admin' is always truthy.
Play Problem Solving ▸