Self Reflection May 11th

Throughout these past few weeks, I believe I did great, but I was talking some of the time with my friends, and although I was talking, I still managed to bypass my goal of 65% and actually got 68% which is good because my previous goal was a bit low expected, so I raised it to this new goal which seems to be a good choice:

One lesson we learned was how to do dictionaries in Ruby, which is also called Hashes in Ruby.

In Ruby to cycle through hashes and to print the values it’s this:

matz = { "key 1" => "value 1",
    "key 2" => value 2",
}
matz.each do |key, value|
      puts matz[key]
end

whichs turns into:

value 1
value 2

{"key 1 "=> "value 1", "key 2" => "value 2"

In Python, though, it’s different. To do it in Python it’s like this:

dic = {"key 1":"value 1","key 1":"value 2"}
for value in dic.itervalues():
    print value

which would print as:

value 1
value 2

This is one way in how Ruby is different to Python, and another way is instead of doing “key 1”: “value 1”, and in Ruby, it’s “key 1” => “value 1”.

This is slightly different to Python but it’s not too different.

My old goal was a good amount to achieve, so my next goal is to get from 68% to 85%, which should be a good goal to get.

Leave a Reply

Your email address will not be published. Required fields are marked *