Create a gist now

Instantly share code, notes, and snippets.

Keyword list maker
puts "Please enter a keyword to go with your 50 states"
keyword = gets.chomp
puts "Would you like your keyword to go before (b) or after(a) your state?"
answer = gets.chomp
states = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado",
"Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
"Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana",
"Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota",
"Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
"New Hampshire", "New Jersey", "New Mexico", "New York",
"North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon",
"Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
"Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington",
"West Virginia", "Wisconsin", "Wyoming"]
if answer == "a"
new_keywords = states.map { |e| "#{e} #{keyword}"}
elsif answer == "b"
new_keywords = states.map { |e| "#{keyword} #{e}"}
end
keyword_file = File.new("#{keyword}.out", "w")
keyword_file.puts new_keywords
keyword_file.close
puts "Your file has been created."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment