Hello all,
I need a little help with Dictionary statement. My question is it possible to display just one thing for a Dictionary ? I know that Dictionary use Keys and Values so if I have this code.
How would I display let say the Dog from Dictionary without printing the value in print statment and then show the value without showing Dog and so on. Can this be done. I am New to Python so please try explain fully what you are doing. Thankyou
# use a dictionary for key(items and cost valve of item)
dic = {'Dog' :10, 'Cat' :50, 'Boat' :35,}
# use tuffle for money that you got
m =(100)
# display items for sale
print ' I have the following items for sale '
print
for k, v in sorted(dic.items()):
print k, ' at' ,v, ' money.\n'
#buying a item and deducting money