Caroline Class Reflection

by Caroline Hall

05 Jun 2017

Overall, this class has been a positive experience and a great way to begin graduate school here at UNC. The way that the material is taught makes it fun and lighthearted, while also challenging and engaging. I enjoy the layout of the class and the open atmosphere that you create as a professor. It’s very obvious that we are all here to learn and that asking questions, regardless of their simplicity, is accepted and encouraged. It’s nice to feel like we won’t be judged for being slow to learn on some chapters and subjects.

A lightbulb that has gone off for me is the relationship between all of the different loops that you can create. A prime example of this is the “Total, Count, Average” Loops exercise that we did. I struggled with this a lot, but then finally figured something out. While this was my lightbulb moment, I have to also say that it would be something that I would like to go through again in class because of the amount of time that it did take to come up with this solution.

while True:
  prompt = input("Please enter a number: \n")
  if prompt == 'done':
    print (total, counter, (total/counter))
    break
  else:
    try:
      number = float(prompt)
      total = total + number
    except:
      print ("Invalid input. Please enter a number.")
      continue
    counter = counter + 1

The complexity of having the Try and Except nested within the If Else within the While True took me a while to figure out, but makes sense when you speak aloud and code or read the code logically step by step.

def circle_pattern(x,y):
  colors1 = ["red", "orange", "yellow", "pink", "light green"]
  colors2 = ["purple", "green", "yellow", "pink", "teal"]
  colors3 = ["magenta", "skyblue", "blue", "light green", "gray"]
  colors4 = ["mediumaquamarine", "light green", "yellow", "red", "powder blue"]
  if y >= 0:
    if x < 0:
      for count in range(5):
        color_1 = random.choice(colors1)

This is only a portion of by code for my Clicky Turtles exercise, but this exercise also helped me work with loops and their relationship with the number of loops through the code and what the inputs within a function are.

Something that is still fuzzy to me somewhat, is the relationship between loops that are not nested together and how they affect one another. An example of this would be if you had a While loop and another For or If loop in the code before or after the While loop.

Overall, one of the best problem solving strategies that works for me is reading what the assignment is as soon it’s assigned or before it’s assigned and not working on it for a few hours to a day. I’ll brainstorm the problem away from my laptop and try to come up with potential creative ideas that I can execute. Then, I’ll return to my keyboard and try to code portions of it from memory from class. Seeing source code and looking at how other people solve similar problems is extremely helpful because it poses as a starting point for me to get creative with my own code.

Caroline is a first year Information Science Master's Candidate. She is passionate about renewable energy and the environment. She spends the majority of her time outside of class working for Strata Solar, a national solar farm developer, and United Solar Initiative, an international solar nonprofit. Find Caroline Hall on Twitter, Github, and on the web.