change the pi's configuration with code, but I was unsuccessful.
After changing a setting on the router itself (from WEP to WAP), writing a clean image of Raspian (via NOOBS), followed by running updates (via Ethernet), was enough to work on my Pi3.
I used the following updates:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
Afterwards, I rebooted the Pi, took out the Ethnernet cable, and re-typed my wifi key.
While I wasn't able to directly replicate these results using the Pi Zero on its own, moving the SD card from my Pi3 to the Pi Zero did the trick.
Being new to Raspberry Pi, I'm excited that I've gotten this far. It's challenging to wade through all of the information available online, because so much of it is outdated or too complex.
At this point, I know enough to be dangerous.
For example, I can use sample code to make a Pimoroni Scroll Phat blink.