VPython Lists: Difference between revisions
Nstandish3 (talk | contribs) No edit summary |
Nstandish3 (talk | contribs) No edit summary |
||
Line 7: | Line 7: | ||
State, in your own words, the main idea for this topic | State, in your own words, the main idea for this topic | ||
==Types of Nests== | |||
=== | ===Lists of Numbers=== | ||
The most basic list is one that has numbers in it. The list of numbers may contain integers, floats, or both. | |||
Example: numList = [1,2,3.4,5] | |||
===Lists of Strings=== | |||
Lists can also be comprised of words (strings). These words must have "" surrounding them for the word to be considered a string and for the computer to accept it. | |||
Example: strList = ["lists","are","super","cool"] | |||
=== | ===Lists of Both=== | ||
Lists don't have to be made up of the same type of variable. | |||
For example, the list ["twenty",20,5,"five"] is a valid list. | |||
===Lists of Lists=== | |||
Lists can also contain lists within themselves. These are called nested loops. | |||
Example: [1,"nest",[1,2]] | |||
===Empty Nests=== | |||
Empty nests are commonly used to initiate a variable and avoid program errors when calling upon that empty list. They generally have variables appended into them and grow throughout the program. | |||
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] | 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] |
Revision as of 15:00, 4 December 2015
Claimed by Natalie Standish
This page is about using lists in VPython to do computing at a scale larger than one or two objects.
VPython List
State, in your own words, the main idea for this topic
Types of Nests
Lists of Numbers
The most basic list is one that has numbers in it. The list of numbers may contain integers, floats, or both. Example: numList = [1,2,3.4,5]
Lists of Strings
Lists can also be comprised of words (strings). These words must have "" surrounding them for the word to be considered a string and for the computer to accept it. Example: strList = ["lists","are","super","cool"]
Lists of Both
Lists don't have to be made up of the same type of variable. For example, the list ["twenty",20,5,"five"] is a valid list.
Lists of Lists
Lists can also contain lists within themselves. These are called nested loops. Example: [1,"nest",[1,2]]
Empty Nests
Empty nests are commonly used to initiate a variable and avoid program errors when calling upon that empty list. They generally have variables appended into them and grow throughout the program.
How do we visualize or predict using this topic. Consider embedding some vpython code here Teach hands-on with GlowScript
Examples
Be sure to show all steps in your solution and include diagrams whenever possible
Simple
Middling
Difficult
Connectedness
- How is this topic connected to something that you are interested in?
- How is it connected to your major?
- Is there an interesting industrial application?
History
Put this idea in historical context. Give the reader the Who, What, When, Where, and Why.
See also
Are there related topics or categories in this wiki resource for the curious reader to explore? How does this topic fit into that context?
Further reading
Books, Articles or other print media on this topic
External links
References
This section contains the the references you used while writing this page