Ibbi2010's reflection on Dictionaries

by Ayesha Aslam

08 Jun 2017

Dictionaries definitely seem wonderful. we just saw a glimpse of what dictionaries are capable of, during our live session in class today and I am sure this is just a tip of the iceberg. Since I am a slow learner, I try my best to read up whatever we are supposed to do in the class exercises. I always feel the pressure of holding my pair partner back if I am completely clueless. So I had read chapter 9 and tried to assimilate as much infromation as I could. I also saw Dr.Chuck’s you tube video, which is a part of his video series and a recommended resource.I found that quite interesting and it made my concepts of ‘keys and values’ a little better than by just reading the text. I re read the chapter after coming back home and came across the “get method”. which I thought we could have used in solving the first exercise we did.This is the excerpt of the text:

word = 'brontosaurus'
d = dict()
for c in word:
    d[c] = d.get(c,0) + 1
print(d)

I tried to use this code to see what it does,and it does give the count as well but the result was not as clean.

mydict = {}
stateDict = dict()
for row in sales_table:
    stateDict[row[6]] = stateDict.get(row[6],0) + 1
print(stateDict)

The live exercise in class definitely took the pressure of doing the exercise off of us but I still believe that I will learn more actively when I will attempt the rest of the exercises during the weekend. so my reflection might change within few days. one thing which I am flabbergasted by, is how will I use dictionaries in my final project.I hope I feel more confident in a few days of using dictionaries as we only have few days before the semester ends.I plan to go thorugh whatever material I get get my hands on to learn about dictionaries this weekend.

Ayesha Aslam is a physician and a student of Master's program in Health Informatics at UNC Find Ayesha Aslam on Twitter, Github, and on the web.