<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.physicsbook.gatech.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yzh79850</id>
	<title>Physics Book - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://www.physicsbook.gatech.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yzh79850"/>
	<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/Special:Contributions/Yzh79850"/>
	<updated>2026-04-24T15:58:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.7</generator>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47800</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47800"/>
		<updated>2025-12-02T23:26:22Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible, unlike lists from other languages, such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order in which the elements were added&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc.)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resize when needed. When an object is stored in a list, it is stored as a reference, so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending on whether the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors (click to see the gif if you can&#039;t)]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First, we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuously update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle (click to see the gif if you can&#039;t)]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness make VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, but students will also begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages, where it was used to refer to the bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestone in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Animation VPython Animation]&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Loops VPython Loops]&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
https://www.glowscript.org/#/user/yzh79850/folder/MyPrograms/program/WikiTest&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
https://www.youtube.com/watch?v=4RVZ9UvLoB0&lt;br /&gt;
https://www.youtube.com/watch?v=upMOE4XhpJk&lt;br /&gt;
https://www.geeksforgeeks.org/python/python-lists/&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
https://www.w3schools.com/python/python_lists.asp&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47792</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47792"/>
		<updated>2025-12-02T23:18:41Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors (click to see the gif if you can&#039;t)]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle (click to see the gif if you can&#039;t)]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness makes VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, students begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages where it was used to refer to bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestond in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Animation VPython Animation]&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Loops VPython Loops]&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
https://www.glowscript.org/#/user/yzh79850/folder/MyPrograms/program/WikiTest&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
https://www.youtube.com/watch?v=4RVZ9UvLoB0&lt;br /&gt;
https://www.youtube.com/watch?v=upMOE4XhpJk&lt;br /&gt;
https://www.geeksforgeeks.org/python/python-lists/&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
https://www.w3schools.com/python/python_lists.asp&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47789</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47789"/>
		<updated>2025-12-02T23:17:50Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness makes VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, students begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages where it was used to refer to bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestond in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Animation VPython Animation]&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Loops VPython Loops]&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
https://www.glowscript.org/#/user/yzh79850/folder/MyPrograms/program/WikiTest&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
https://www.youtube.com/watch?v=4RVZ9UvLoB0&lt;br /&gt;
https://www.youtube.com/watch?v=upMOE4XhpJk&lt;br /&gt;
https://www.geeksforgeeks.org/python/python-lists/&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
https://www.w3schools.com/python/python_lists.asp&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47786</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47786"/>
		<updated>2025-12-02T23:15:38Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness makes VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, students begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages where it was used to refer to bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestond in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Animation VPython Animation]&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Loops VPython Loops]&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47785</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47785"/>
		<updated>2025-12-02T23:15:11Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness makes VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, students begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages where it was used to refer to bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestond in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython_Animation VPython Animation]&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47784</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47784"/>
		<updated>2025-12-02T23:14:47Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness makes VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, students begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages where it was used to refer to bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestond in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[http://www.physicsbook.gatech.edu/VPython VPython Animation]&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47783</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47783"/>
		<updated>2025-12-02T23:13:14Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
Lists are incredibly important, and they interact naturally with other data structures in VPython. Combinations like lists, vector math, 3D rendering, loops, and randomness makes VPython an incredibly versatile and ideal teaching model for students. Not only will they be able to review physics concepts, students begin to think computationally and develop more programming skills. In the state of the world, even understanding a bit of programming is vital.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The word &#039;&#039;list&#039;&#039; comes from the Middle Ages where it was used to refer to bordered grounds of a jousting field. This early meaning, being derived from Germanic roots of the word &#039;&#039;band&#039;&#039; or &#039;&#039;border&#039;&#039;, was meant to emphasize order and structure. Over the following centuries, the term began to expand. Medieval administrations kept names on &amp;quot;rolls&amp;quot;, merchants in the 1600s &amp;quot;listed&amp;quot; goods for sale, and political revolutions formalized &amp;quot;ordered&amp;quot; records through roll calls. By the 19th century, mail-order catalogs and growing commercial record-keeping practices helped establish the list as a standard tool for organizing information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Later, the computational list began to emerge in the 20th century due to the introduction of data-processing machines that could arrange information sequentially on punch cards. This idea reached a major milestond in 1958 with the creation of LISP, a programming language built entirely around list processing. As computer science progressed, the term became essential to data structures for storing ordered collections of values. VPython integrates lists perfectly within its own language, creating something for you and me to learn and experiment with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
https://medium.com/circa-navigate/the-long-listed-history-of-the-list-4c4da36a4ed5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47766</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47766"/>
		<updated>2025-12-02T22:49:53Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47761</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47761"/>
		<updated>2025-12-02T22:23:13Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|5 disco balls rapidly changing colors]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|various cyan balls spinning counter clockwise in a circle]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47760</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47760"/>
		<updated>2025-12-02T22:21:59Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|Please show up please please]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
[[File:BallSpinning.gif|thumb|Bro]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=File:BallSpinning.gif&amp;diff=47759</id>
		<title>File:BallSpinning.gif</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=File:BallSpinning.gif&amp;diff=47759"/>
		<updated>2025-12-02T22:20:59Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47758</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47758"/>
		<updated>2025-12-02T22:17:22Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco1.png|thumb|Caption for your GIF]]&lt;br /&gt;
[[File:Disco2.png|thumb|Caption for your GIF]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
For more of a challenge, let&#039;s create a circle of balls and make them rotate! First we would need to create a few variables just to define how many balls and how big the circle is. For this example, we use two lists. One for the individual balls, and the other for their corresponding position/angle in the circle. We can see now how important it is that we can access each ball and its position quickly using a list. Finally, we create a while loop to continuosly update the balls&#039; position so that they appear to be rotating in a circle! &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a bonus challenge, what would we do to make the balls turn in the opposite direction?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
num_balls = 50&lt;br /&gt;
radius = 5.0&lt;br /&gt;
omega = 0.5&lt;br /&gt;
&lt;br /&gt;
balls = []&lt;br /&gt;
angles = []&lt;br /&gt;
&lt;br /&gt;
for k in range(num_balls):&lt;br /&gt;
    theta = 2*3.14 * k / num_balls&lt;br /&gt;
    pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
    b = sphere(pos=pos, radius=0.15, color=color.cyan)&lt;br /&gt;
    balls.append(b)&lt;br /&gt;
    angles.append(theta)&lt;br /&gt;
&lt;br /&gt;
dt = 0.01&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    for k in range(num_balls):&lt;br /&gt;
        angles[k] += omega * dt&lt;br /&gt;
        theta = angles[k]&lt;br /&gt;
        balls[k].pos = vector(radius * cos(theta), radius * sin(theta), 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47755</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47755"/>
		<updated>2025-12-02T22:09:24Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco1.png|thumb|Caption for your GIF]]&lt;br /&gt;
[[File:Disco2.png|thumb|Caption for your GIF]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47754</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47754"/>
		<updated>2025-12-02T22:08:50Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco1.png|thumb|Caption for your GIF]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=File:Disco2.png&amp;diff=47752</id>
		<title>File:Disco2.png</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=File:Disco2.png&amp;diff=47752"/>
		<updated>2025-12-02T22:08:28Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: balls&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
balls&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=File:Disco1.png&amp;diff=47750</id>
		<title>File:Disco1.png</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=File:Disco1.png&amp;diff=47750"/>
		<updated>2025-12-02T22:07:57Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47748</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47748"/>
		<updated>2025-12-02T22:05:36Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|Caption for your GIF]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47745</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47745"/>
		<updated>2025-12-02T22:00:34Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Disco.gif|thumb|Caption]]&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=File:Disco.gif&amp;diff=47744</id>
		<title>File:Disco.gif</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=File:Disco.gif&amp;diff=47744"/>
		<updated>2025-12-02T21:59:02Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: 5 balls rapidly changing colors&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
5 balls rapidly changing colors&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47738</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47738"/>
		<updated>2025-12-02T21:48:26Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
Let&#039;s say we want to create 5 disco balls and make them change colors repeatedly. We first create a list and set how many balls we want. Afterwards, we add all of the balls into the scene and the list. Finally, we create a loop that changes the color of each ball depending if the variable &#039;t&#039; is even or odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 5&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(i*2-3, 0, 0)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.white)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
t = 0&lt;br /&gt;
dt = 1&lt;br /&gt;
while True:&lt;br /&gt;
    rate(100)&lt;br /&gt;
    t += dt&lt;br /&gt;
    if t % 2 == 0 :&lt;br /&gt;
        ball_list[0].color = color.blue&lt;br /&gt;
        ball_list[1].color = color.red&lt;br /&gt;
        ball_list[2].color = color.green&lt;br /&gt;
        ball_list[3].color = color.yellow&lt;br /&gt;
        ball_list[4].color = color.orange&lt;br /&gt;
    else :&lt;br /&gt;
        ball_list[0].color = color.red&lt;br /&gt;
        ball_list[1].color = color.green&lt;br /&gt;
        ball_list[2].color = color.blue&lt;br /&gt;
        ball_list[3].color = color.purple&lt;br /&gt;
        ball_list[4].color = color.yellow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47687</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47687"/>
		<updated>2025-12-02T18:47:40Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
In creating the basic list, there are two components: the name and the contents. If we look at the first part of this line of code, we can see that we have named the list as &#039;ball_list&#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = [];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list can have any kind of name. It could be called &#039;x&#039;, &#039;alotofballs&#039;,&#039;billnyethescienceguy&#039;, or anything you want. However, the best names are intuitive and help both you and other people understand your code easily. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second part of creating a list is the contents. The contents of a list can either be empty or have something already there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.1)&lt;br /&gt;
ball2 = sphere(color=color.red, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.yellow, radius=0.3)&lt;br /&gt;
&lt;br /&gt;
ball_list = [ball1, ball2, ball3]&lt;br /&gt;
box_list = []&lt;br /&gt;
duck_list = [sphere(color=color.white, radius=0.2)]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are just some examples!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lists are dynamic arrays that automatically resizes when needed. When an object is stored in a list, it is stored as a reference so changing an item in the list will update itself in the scene instantly. The access cost is also O(1), making updates and finding objects fast. For searching, the time complexity is O(n). It takes a while, but it gets the job done.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47665</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47665"/>
		<updated>2025-12-02T16:23:14Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VPython lists are pretty flexible unlike lists from other languages such as:&lt;br /&gt;
*containing duplicate items&lt;br /&gt;
*easily modifying, replacing, or removing elements&lt;br /&gt;
*keeps track of the order elements were added in&lt;br /&gt;
*elements accessed through their position&lt;br /&gt;
*containing different data types (integers, strings, booleans, etc)&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47663</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47663"/>
		<updated>2025-12-02T16:16:30Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47662</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47662"/>
		<updated>2025-12-02T16:14:48Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Yu Zhou Fall 2025&#039;&#039;&#039;&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47659</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47659"/>
		<updated>2025-12-02T07:21:41Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Yu Zhou Fall 2025&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is where we create our list&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
# We set how many balls to add to our list&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
# Inside this loop, we add num_balls amount of balls to the list&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
&lt;br /&gt;
    # Every time we add a ball, we put it next to the previous ball&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
&lt;br /&gt;
    # radius is 1 for the ball&lt;br /&gt;
    radius = 1&lt;br /&gt;
&lt;br /&gt;
    # We create the ball&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    # Finally, we add it to the list&lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47658</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47658"/>
		<updated>2025-12-02T07:18:59Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Yu Zhou Fall 2025&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls to help you stop a 17, 500 kg block of mass sliding right at you using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized, and you probably don&#039;t want to count all the way to &#039;ball12000&#039;. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47657</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47657"/>
		<updated>2025-12-02T07:16:51Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Yu Zhou Fall 2025&lt;br /&gt;
An introduction to creating and using lists in VPython.&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
Let&#039;s say you want to create 100 or maybe even &#039;&#039;12,000&#039;&#039; tennis balls using VPython. Now, you could perhaps do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball1 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball2 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball3 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball4 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
ball5 = sphere(color=color.blue, radius=0.2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and so on and so on. However, this can get really disorganized. Fortunately, we can use lists to contain all of these balls!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ball_list = []&lt;br /&gt;
&lt;br /&gt;
num_balls = 1000&lt;br /&gt;
&lt;br /&gt;
for i in range(num_balls):&lt;br /&gt;
    pos = vector(0, 0, i)&lt;br /&gt;
    radius = 1&lt;br /&gt;
    ball = sphere(pos=pos, radius=radius, color=color.red)&lt;br /&gt;
    &lt;br /&gt;
    ball_list.append(ball)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that&#039;s a lot of balls.&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47656</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47656"/>
		<updated>2025-12-02T06:53:52Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Yu Zhou Fall 2025&lt;br /&gt;
An introduction to creating and using loops in VPython.&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Middling===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
===Further Reading===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===External Links===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47655</id>
		<title>Energy Graphs</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47655"/>
		<updated>2025-12-02T06:48:23Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47654</id>
		<title>VPython Lists</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=VPython_Lists&amp;diff=47654"/>
		<updated>2025-12-02T06:48:07Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: Created page with &amp;quot;Yu Zhou Fall 2025&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Yu Zhou Fall 2025&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47653</id>
		<title>Energy Graphs</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47653"/>
		<updated>2025-12-02T06:16:32Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;YU ZHOU FALL 2025&lt;br /&gt;
Short Description of Topic&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
&lt;br /&gt;
State, in your own words, the main idea for this topic&lt;br /&gt;
Electric Field of Capacitor&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
What are the mathematical equations that allow us to model this topic.  For example &amp;lt;math&amp;gt;{\frac{d\vec{p}}{dt}}_{system} = \vec{F}_{net}&amp;lt;/math&amp;gt; where &#039;&#039;&#039;p&#039;&#039;&#039; is the momentum of the system and &#039;&#039;&#039;F&#039;&#039;&#039; is the net force from the surroundings.&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
How do we visualize or predict using this topic. Consider embedding some vpython code here [https://trinket.io/glowscript/31d0f9ad9e Teach hands-on with GlowScript]&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
Be sure to show all steps in your solution and include diagrams whenever possible&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
===Middling===&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
#How is this topic connected to something that you are interested in?&lt;br /&gt;
#How is it connected to your major?&lt;br /&gt;
#Is there an interesting industrial application?&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Put this idea in historical context. Give the reader the Who, What, When, Where, and Why.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
Are there related topics or categories in this wiki resource for the curious reader to explore?  How does this topic fit into that context?&lt;br /&gt;
&lt;br /&gt;
===External links===&lt;br /&gt;
&lt;br /&gt;
Internet resources on this topic&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
This section contains the the references you used while writing this page&lt;br /&gt;
&lt;br /&gt;
[[Category:Which Category did you place this in?]]&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47652</id>
		<title>Energy Graphs</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47652"/>
		<updated>2025-12-02T06:13:42Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;YU ZHOU FALL 2025&lt;br /&gt;
Short Description of Topic&lt;br /&gt;
&lt;br /&gt;
==The Main Idea==&lt;br /&gt;
&lt;br /&gt;
State, in your own words, the main idea for this topic&lt;br /&gt;
Electric Field of Capacitor&lt;br /&gt;
&lt;br /&gt;
===A Mathematical Model===&lt;br /&gt;
&lt;br /&gt;
What are the mathematical equations that allow us to model this topic.  For example &amp;lt;math&amp;gt;{\frac{d\vec{p}}{dt}}_{system} = \vec{F}_{net}&amp;lt;/math&amp;gt; where &#039;&#039;&#039;p&#039;&#039;&#039; is the momentum of the system and &#039;&#039;&#039;F&#039;&#039;&#039; is the net force from the surroundings.&lt;br /&gt;
&lt;br /&gt;
===A Computational Model===&lt;br /&gt;
&lt;br /&gt;
How do we visualize or predict using this topic. Consider embedding some vpython code here [https://trinket.io/glowscript/31d0f9ad9e Teach hands-on with GlowScript]&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
Be sure to show all steps in your solution and include diagrams whenever possible&lt;br /&gt;
&lt;br /&gt;
===Simple===&lt;br /&gt;
===Middling===&lt;br /&gt;
===Difficult===&lt;br /&gt;
&lt;br /&gt;
==Connectedness==&lt;br /&gt;
#How is this topic connected to something that you are interested in?&lt;br /&gt;
#How is it connected to your major?&lt;br /&gt;
#Is there an interesting industrial application?&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Put this idea in historical context. Give the reader the Who, What, When, Where, and Why.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
Are there related topics or categories in this wiki resource for the curious reader to explore?  How does this topic fit into that context?&lt;br /&gt;
&lt;br /&gt;
===Further reading===&lt;br /&gt;
&lt;br /&gt;
Books, Articles or other print media on this topic&lt;br /&gt;
&lt;br /&gt;
===External links===&lt;br /&gt;
&lt;br /&gt;
Internet resources on this topic&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
This section contains the the references you used while writing this page&lt;br /&gt;
&lt;br /&gt;
[[Category:Which Category did you place this in?]]&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
	<entry>
		<id>http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47377</id>
		<title>Energy Graphs</title>
		<link rel="alternate" type="text/html" href="http://www.physicsbook.gatech.edu/index.php?title=Energy_Graphs&amp;diff=47377"/>
		<updated>2025-11-28T02:40:11Z</updated>

		<summary type="html">&lt;p&gt;Yzh79850: Created page with &amp;quot;YU ZHOU FALL 2025&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;YU ZHOU FALL 2025&lt;/div&gt;</summary>
		<author><name>Yzh79850</name></author>
	</entry>
</feed>