If it's Raspbian then pi
is allowed passwordless sudo
by default. See https://www.raspberrypi.org/forums/viewtopic.php?t=169212#p1087020 (English) for a way to adjust that.
Edit: TLDR
sudo nano /etc/sudoers.d/010_pi-nopasswd
There's only one line:
pi ALL=(ALL) NOPASSWD: ALL
Change it to
pi ALL=(ALL) PASSWD: ALL