forked from aiti-ghana-2012/Lab_Python_04
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab04.py
More file actions
36 lines (36 loc) · 1.71 KB
/
Copy pathLab04.py
File metadata and controls
36 lines (36 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
groceries=['bananas','strawberries','apples','bread']
groceries.append('champagne')
print groceries
print'-------------------------------------------------------------------'
groceries.remove('bread')
print groceries
print'---------------------------------------------------------------------'
grocery_aisle={'bananas':'b','strawberrise':'s','apples':'a','bread':'b','champagne':'c'}
for key,value in grocery_aisle.iteritems():
print '\t',key,'\t',value,'\n'
print'-------------------------------------------------------------------'
grocery_price={'Apples':'7.3','Bananas':'5.5','bread':'1.0','Carrots':'10.0','Champagne':'20.90','Strawberries':'32.6'}
for key,value in grocery_price.iteritems():
print '\t',key,'\t',value,'\n'
print'----------------------------------------------------------------------'
grocery_price['Strawberries']='63.43'
for key,value in grocery_price.iteritems():
print '\t',key,'\t',value,'\n'
print'----------------------------------------------------------------------'
grocery_price['Chicken']='6.5'
for key,value in grocery_price.iteritems():
print '\t',key,'\t',value,'\n'
print '---------------------------------------------------------------------'
""" I would use the list data structure. This becomes it's easier making
modifications to the items within the lists."""
print
in_stock=['bananas','strawberrise','apples','bread','champagne']
for i in in_stock:
print i
print'---------------------------------------------------------------------'
always_in_stock=('bananas','strawberrise','apples','bread','champagne')
print always_in_stock
print'---------------------------------------------------------------------'
print"Come to Shoprite! We always sell:"
for i in always_in_stock:
print i