Use a list or array in Python?
<p>I need to store information for 6 items and their respective length, width and cost values and then work out some values based on user input.</p>

<p>With the help of jcusick, I have now the code below. </p>

<p>I now need help for the items marked in the comments (#).</p>

<p>You do not need to write the complete code - pointing in right direction is perfect. </p>

<p>So far I have:</p>

<pre><code>cost = {}
cost['Themon'] = 450
cost['Larrec'] = 700
cost['Medrec'] = 500
cost['Parallel'] = 825
cost['Suncatch'] = 400
cost['Chantran'] = 975

length = {}
length['Themon'] = 3.2
length['Larrec'] = 3.4
length['Medrec'] = 2.1
length['Parallel'] = 5
length['Suncatch'] = 3
length['Chantran'] = 9

width = {}
width['Themon'] = 2.3
width['Larrec'] = 3
width['Medrec'] = 2
width['Parallel'] = 4
width['Suncatch'] = 3
width['Chantran'] = 6

area = {}
area['Themon'] = 1 # how do i calculate the area (l*w) by referencing the lenght and width dictionary 
area['Larrec'] = 1
area['Medrec'] = 1
area['Parallel'] = 1
area['Suncatch'] = 1
area['Chantran'] = 1

#menu
ans=True
while ans:
    print("""
    Enter 1. to find cheapest garden deck 
    Enter 2. to display the names of garden decks over a certain lenght
    Enter 3. to display the number of garden decks that are available over a certain area
    Enter 4. to quit
    """)
    ans=input("What option would you like? ")
    if ans=="1":
        print (min(cost, key=cost.get))
    elif ans=="2":
        input_length = input("\n Please enter minimum deck length between 2 and 15 metres")
        print # i need to display names of the decks greater than the user input length
    elif ans=="3":
        input_area = input("\n Please enter deck area in metres squared between 4 and 80")
        print # i need to display the number of garden decks that are greater that the user input area
    elif ans=="4":
        print("\n Thank you for using Penny's Decking")
    else:
        print("\n Not a valid choice")
</code></pre>

<p>I might consider creating a <a href="https://docs.python.org/2/tutorial/datastructures.html#dictionaries" rel="nofollow">dictionary</a> for each of the variables your are interested in (length, width, cost). Then you could always query the specific dictionary depending on what the user answers:</p>

<pre><code>cost = {}
cost['Themon'] = 450
cost['Larrec'] = 700
...
print (min(cost, key=cost.get))
# 'Themon'
</code></pre>

python python-3.x