March 5th, 2005, 10:37 AM
Point me in the right direction.
I'm new to python and programming in general. I'm working on a program for a friend. Basically that would take inputed measurements take some deductions and some counts. My question is Is there a type of dynamic array for python? One that I could add to as the expressions are added as input from the keyboard.
I haven't been able to get my mind around list, tuples and dictionaries. If you can suggest which is my best option I will take it from there. Thanks.
March 5th, 2005, 12:15 PM
Use the List, this is basically as you referred to it a "Dynamic Array". You can use the append() method to add elements to the list like so.
>>> aList = 
[0, True, 'String']
[0, True, 'String', 'String']
Hope this helps,
March 5th, 2005, 12:23 PM
yes definitely helped.
I just need a hint (in enlish) thanks.
March 5th, 2005, 01:14 PM
A List is a mutable array, this means that it can add new valued to it after it’s created. This is usually done by prefixing your list with .append(valueToAdd) as in the example above.
A Tuple is pretty much the same but is immutable, so can't add values to it after it has been created.
You probably won’t use a dictionary for this but simply: Dictionaries are like arrays but they use keys (usually strings) to access the stored values rather than an index/number.
March 5th, 2005, 04:31 PM
I'm using a book by chris Fehily visual quickstart guide. The language is a little difficulf for this high school grad. haha thank you again my program is looking good now.