So if you are on the moon and want to stay alive you have to wear a space suit. So the question becomes why can’t you whistle in a space suit? Well it is to do with air pressure.
So when you whistle you push air through your mouth and lips and cause a turbulent airstream which moves about fast enough that it can be hear by human ears.
In a space suit the air pressure in about 1/3 of what is on earth, which means less air molecules in the air to vibrate, which means you can’t create a stream of air which vibrates fast enough to hear, which means no whistle.