Python is a free, text-based programming language that has already been used by those who do physics research to great effect. But students can also learn to use it and, through its use, learn other aspects of physics—especially ones that are difficult or impossible to perform as physical labs. This article serves as a most-fundamental start for teachers who are interested in how they can use Python to enhance their physics instruction. Although there have been a few articles that have made references to using Python, none so far in this journal has described how quickly and effectively it can be used to simulate a virtual lab experience or aid in creative design. In this first of two articles, I introduce Python (and VPython) and provide some sample codes to guide beginners.

1.
My code is here is partially inspired by this YouTube video series by Christian Thompson on animating a bouncing ball: https://www.youtube.com/watch?v=HHQV3ifJopo.
2.
John R.
Leeman
, “
A student’s guide to Python for physical modeling
,”
Am. J. Phys.
85
,
399
(
May
2017
).
3.
These simulations are found on the VPython.org website. As for the text, see
Ruth
Chabay
and
Bruce
Sherwood
,
Matter and Interactions
, 4th ed. (
Wiley
,
2014
).
4.
See the appendix at TPT Online, https://doi.org/10.1119/1.5084937 under the Supplement tab.
5.
Ruth
Chabay
and
Bruce
Sherwood
, “
Computational physics in the introductory calculus-based course
,”
Am. J. Phys.
76
,
307
(
April
2008
).

Supplementary Material

AAPT members receive access to The Physics Teacher and the American Journal of Physics as a member benefit. To learn more about this member benefit and becoming an AAPT member, visit the Joining AAPT page.