Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update worksheet.rb #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update worksheet.rb #1

wants to merge 1 commit into from

Conversation

jwinchan
Copy link
Owner

Assignment Submission: Ride Share

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What did your data structure look like at first? Did this structure evolve over time? Why? My initial thought was to create an array of each individual ride. However, I changed my structure to be a hash with each driver as a key and the value is an array of their rides. I decided on this structure because all the questions were centered on the driver's stats.
What was your strategy for going through the data structure and gathering information? My strategy was to loop through the data as few times as possible. Since I was looping through the cost data and then the ratings data in questions 2 and 3, I used those loops to create a hash that I could access afterwards since questions 4 and 5 also referred to the same data.
What was an example of something that was necessary to store in a variable? Why was it necessary, useful, or helpful? I stored the revenue hash and the ratings hash in a variable so that I could access that data for questions 4 and 5. It was definitely helpful because otherwise, I would've had to iterate through my data structure again to pull that data.
What kinds of iteration did you use? Did you use .map? If so, when? If not, why, or when would be a good opportunity to use it? I used .each_pair the most since I was iterating through my hash and needed to use both the key and values in my iteration. I only used .map in the optional enhancements. Most of the time, .map wasn't useful for me since I didn't want to output an array until the optional exercise.
Were some calculations easier than others? Why? The first question was the easiest since I already structured my data to have each driver as a key and the array of their rides as a value. So calculating the length of the values (an array) gave me the total trips each driver drove.

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.

1 participant