How to run Sudo code without password in mac

What’s more interesting is that you’re removing a file in /tmp. If I remember my Unix correctly, shouldn’t /tmp be world-writable, so anyone should be able to delete a file from this directory?