Write a program that will tell you whether a year is a leap year.
A leap year is a year divisible by 4 unless it is also divisible by 100. If the year is divisible by 400, it is a leap year.
leap_year?(1840) # => true
import sublime, sublime_plugin | |
class ToggleColorSchemeCommand(sublime_plugin.TextCommand): | |
def run(self, edit, **args): | |
light_scheme = "Packages/User/Solarized (Light) (SL).tmTheme" | |
dark_scheme = args["dark_color_scheme"] | |
settings = sublime.load_settings('Preferences.sublime-settings') | |
current_scheme = settings.get('color_scheme') |
Write a program that checks whether input is a palindrome or not.
Example method call:
is_palindrome?('maddam') # => true
is_palindrome?("a man a plan a canal panama") # => true
Write a program that, given a word and a list of possible anagrams, selects the correct one(s).
In other words, given: "listen"
and %w(enlists google inlets banana)
the program should return "inlets".
Run it like so:
find_anagram("listen", %w(enlists google inlets banana))
# => "Inlets is the Anagram for Listen"