This paper explores the application of generative artificial intelligence (AI) and Python programming in physics education. With the assistance of the generative AI tool DeepSeek, the authors carried out three iterative cycles to generate and refine Python code, ultimately developing an electrostatic-field simulation case. This demonstrates how generative AI can be leveraged to create and visualize such simulations. Practical experience shows that while AI can substantially lower the programming barrier for simulation experiments, the results it produces may deviate from actual physical laws and therefore require human verification and adjustment.
YE et al. (Wed,) studied this question.