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

Create Pipes - Iuliia - Random_Menu.rb #41

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

Conversation

julalam
Copy link

@julalam julalam commented Aug 10, 2017

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
How did you store menu components? Why? I stored all user's input in 3 arrays. Array is a great way to store many elements at one place.
Could you have stored components using a different data structure? For example, if you used an Array could you have used a Hash? I didn't use a Hash because all the information I get from a user don't correlate between different elements
Did you find yourself repeating the same code? Why did you have to do it that way? My code is repeating when I am asking user for input. It repeats 3 times due to building 3 different arrays. I could make it only one loop but this way user will have to input 1 element for each array and not all elements for 1 array and then for the other two.
What type of loop did you use? Why did you choose that type? I used "times" loop and "if" statement. I choose the "time" loop to not to write the same code 10 times asking a user to enter 10 elements. "if" statement helped me to handle the situation when user is asking for the menu which contains more items than it was stored in my arrays.

selected_style << (style - selected_style).sample
selected_food << (food - selected_food).sample

puts "#{i+1}. #{selected_adj.last} #{selected_style.last} #{ selected_food.last}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we talked about this in class, but I like this idea for making sure you don't repeat items. A similar but possibly cleaner way would to be to delete the sampled word from the list, rather than subtracting the lists every time. Something like:

selected_adj = adj.sample
adj.delete(selected_adj)

@droberts-sea
Copy link
Collaborator

Random Menu

What We're Looking For

Feature Feedback
Random Menu of 10 items displayed in the terminal. Yes
Generator pulls one random item from each array to create menu items. Yes
Baseline
Readable code with consistent indentation. Yes

Great work overall! Good job on the optionals.

@julalam julalam changed the title Create Iuliia's_Random_Menu.rb Create Pipes - Iuliia - Random_Menu.rb Aug 11, 2017
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