Skip to content

Instantly share code, notes, and snippets.

@Niall47
Created October 29, 2021 11:03
Show Gist options
  • Save Niall47/114b364d4b3229432716cc558a884cc5 to your computer and use it in GitHub Desktop.
Save Niall47/114b364d4b3229432716cc558a884cc5 to your computer and use it in GitHub Desktop.
resistor_colours = ['black', 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'violet', 'grey', 'white']
input_array = gets.chomp.gsub(' ', '').split('-')
puts resistor_colours.find_index(input_array[0]).to_s + resistor_colours.find_index(input_array[1]).to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment