Python for AIIntermediate13 September 2026
Why should a Python application usually keep AI provider API keys in environment variables or a secret manager instead of hard-coding them in source code?
Pick an answer to see the explanation.
Answer
To reduce the risk of credentials being exposed through source control or shared code
Secrets should be separated from application source code. Environment-based configuration or dedicated secret-management systems reduce accidental exposure through repositories and allow credentials to be rotated and managed differently across development, testing, and production environments.
Learn more: Explore AI automation with Python →