Skip to content

Conversation

@Shantelgray
Copy link

Enumberable Lab

Comment on lines +43 to +47
spicy_foods.each do |display|
if display[:heat_level] > 5
puts "#{display[:name]} (#{display[:cuisine]}) | Heat Level: " + "🌶" * display[:heat_level]
end
end

Choose a reason for hiding this comment

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

Watch you spacing and naming. If you have good spacing, it make it easier to follow your code which can help with debugging and reading.

Suggested change
spicy_foods.each do |display|
if display[:heat_level] > 5
puts "#{display[:name]} (#{display[:cuisine]}) | Heat Level: " + "🌶" * display[:heat_level]
end
end
spicy_foods.each do |food|
if food[:heat_level] > 5
puts "#{food[:name]} (#{food[:cuisine]}) | Heat Level: " + "🌶" * food[:heat_level]
end
end

# the average heat level of all the spicy foods in the array
def average_heat_level(spicy_foods)
# your code here
average_heat = spicy_foods.sum do |food| food[:heat_level]

Choose a reason for hiding this comment

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

Again, naming is important.

Suggested change
average_heat = spicy_foods.sum do |food| food[:heat_level]
total_heat = spicy_foods.sum do |food| food[:heat_level]

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