Created
July 27, 2011 05:32
-
-
Save MelanieS/1108745 to your computer and use it in GitHub Desktop.
Keyword list maker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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