Skip to content

Create Amber_Lynn_Assignment#43

Open
griffifam wants to merge 2 commits into
Ada-C10:masterfrom
griffifam:master
Open

Create Amber_Lynn_Assignment#43
griffifam wants to merge 2 commits into
Ada-C10:masterfrom
griffifam:master

Conversation

@griffifam

Copy link
Copy Markdown

rideshare

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? hashes with hashes; I had to keep track of how many levels I had and the best way to collect each driver's information
What was your strategy for going through the data structure and gathering information? trial and error, when in doubt print it out
What was an example of something that was necessary to store in a variable? What was the scope of each of that variables? Why? total_rating was defined inside variable but unavailable unless I returned it. Its scope was accessible in method and method only
What kinds of iteration did you use? Did you use .map? I used 'map', each_with_index, count and times
Were some calculations easier than others? Why? Trying to calculate between drivers was difficult. I did not finish the last two parts of the assignment

@tildeee

tildeee commented Aug 15, 2018

Copy link
Copy Markdown
Collaborator

Hey Amber! Good work on this project.

I like the data structure you have! Similarly, your methods look great. Overall, I think your strategy for solving a problem-- creating a starting value at the beginning of each method, iterating through the relevant parts of the data, and then changing those values, and finally returning them.

You end up using this syntax to iterate through the data:

hash[key].map.each_with_index do |(key, value), index|

or

hash[key].map.count.times do |i|

.map is a method that operates on a datastructure (like your hash, or an array) and "enumerates" on it... much like a loop. Above, you are also chaining .each_with_index or .times, which do very similar loops. I wouldn't expect that you need to do both... My guess is that one or the other will work :)

in fact, try running your code with these modifications (taking out the .map):

hash[key].each_with_index do |(key, value), index|

or

hash[key].count.times do |i|

Let me know if you have a question on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants