This file contains 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
# Your friend won't stop texting his girlfriend. It's all he does. All day. Seriously. The texts are so mushy too! The whole situation just makes you feel ill. Being the wonderful friend that you are, you hatch an evil plot. While he's sleeping, you take his phone and change the autocorrect options so that every time he types "you" or "u" it gets changed to "your sister." | |
# Write a function called autocorrect that takes a string and replaces all instances of "you" or "u" (not case sensitive) with "your sister" (always lower case). | |
# Return the resulting string. | |
# Here's the slightly tricky part: These are text messages, so there are different forms of "you" and "u". | |
# For the purposes of this kata, here's what you need to support: |
This file contains 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
# A string is considered to be in title case if each word in the string is either (a) capitalised (that is, only the first letter of the word is in upper case) or (b) considered to be an exception and put entirely into lower case unless it is the first word, which is always capitalised. | |
# Write a function that will convert a string into title case, given an optional list of exceptions (minor words). The list of minor words will be given as a string with each word separated by a space. | |
# Your function should ignore the case of the minor words string -- it should behave in the same way even if the case of the minor word string is changed. | |
# ###Arguments (Haskell) | |
# First argument: space-delimited list of minor words that must always be lowercase except for the first word in the string. | |
# Second argument: the original string to be converted. | |
# ###Arguments (Other languages) |
This file contains 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
#write me a function stringy that takes a size and returns a string of alternating '1s' and '0s'. | |
#the string should start with a 1. | |
#a string with size 6 should return :'101010'. | |
#with size 4 should return : '1010'. | |
#with size 12 should return : '101010101010'. | |
#The size will always be positive and will only use whole numbers. | |
#My Solution: |
This file contains 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
#Jenny has written a function that returns a greeting for a user. However, she's in love with Johnny, and would | |
#like to greet him slightly different. She added a special case to her function, but she made a mistake. | |
#Can you help her? | |
#Initial Code with Error: | |
def greet(name) | |
return "Hello, #{name}!" | |
return "Hello, my love!" if name == "Johnny" | |
end |
OlderNewer