WRITE A FUNCTION IN THE LANGUAGE OF YOUR CHOICE THAT TAKES A STRING AS INPUT, DOUBLES EVERY CONSONANT AND PLACES AN 'O' IN BETWEEN.
FOR EXAMPLE, 'I'M A GIANT FAGGOT' SHOULD RETURN 'I'MOM A GOGIANONTOT FOFAGOGGOGTOT".
TICK TOCK, BIRD DOESN'T LIKE WAITING.
Jordan Cooper
PUMP A RUM
Juan Miller
def foo(string): result = ""
for letter in string: if letter != " ": result += letter result += "O" result += letter else: result += letter
return result
Samuel Bell
PICKLE PEE
Liam Stewart
WHAT ARE REGULAR EXPRESSIONS.
STOP POSTING TRIVIAL EXERCISES. WHAT IS THIS, HIGHSCHOOL COMPUTER LAB?
FUCK OFF.
Thomas Turner
THEN DO IT
David Lopez
...
Luis Smith
HOW ABOUT YOU FIX YOUR OWN CODE FIRST.
Ian Wright
who is birding who ?
Isaiah Lee
DO YOU WANT TO BE HIRED, BIRD POSER
WHOM BOI
Jordan Myers
import string vows="EeUuIiOoAa" cons=filter(lambda x: x not in vows,string.letters) def shit_tier_challenge_16271627812(txt): return reduce(lambda x,y: x+y+"o"+y if y in cons else x+y, txt, "")
Could have been a nice one liner if I wasn't bored to write all the consonants myself or a two liner with import string if I wasn't disgusted from the idea of generating cons every time reduce looped through
Bentley Brooks
Yeah this one is stupid.
Asher Anderson
THIS IS FIZZBUZZ LEVEL PROGRAMMING, NOBODY IS GOING TO HIRE YOU TO FIZZBUZZ.
Jonathan Allen
FIGHT BIRDS, FIGHT
Kayden Brooks
Will crash on special symbols
Here is my solution #include #include #include #include #include
"that's what I call AUTISM.." .gsub(/[bcdfghj-np-tv-z]/) {|i| i+'o'+i} .gsub(/[BCDFGHJ-NP-TV-Z]/) {|i| i+'O'+i}
Ethan Martinez
Nice homework. def insert_o(sentence): ''.join([w + 'o' + w if w not in 'aeiou' and w not in ' 1234567890\'' else w for w in x]) Also, as said, you should use regular expressions, if you don't want to check against a list of all consonants. There's too many characters to avoid, and in my example I avoided only digits, space and '. To tell the truth, I only did this because I love list comprehensions.
Dominic Cooper
Except 'x' should be 'sentence'. I done goofed when I copy/pasted the line from the terminal.
The "eval" uu guy: eval unpack u=>q{_=VAI;&4@*#P^*2!["B`@8VAO;7`["B`@0'0@/2!M87`@>PH@("`@(2];865I;W4@7%==+R`_("1?+B)/(BXDY7R`Z("1?"B`@?2!S
Josiah Barnes
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace just_do_it { class Program { static void Main(string[] args) { string doit; Console.WriteLine("type something"); doit=Console.ReadLine(); doit=DoTheThing(doit); Console.WriteLine(doit); Console.ReadLine();
} public static string DoTheThing(string Sentence) { string ReturnedString = ""; foreach(char letter in Sentence) { switch(letter) { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U': case 'y': case 'Y': ReturnedString = ReturnedString + 'O' + letter; break; default: ReturnedString = ReturnedString + letter; break;
} } return ReturnedString;
} } }
Jacob Thomas
function conO(str) { var str = str.replace(/([bcdfghjklmnpqrstvwxyz])/ig, '$1O$1'); return str; }
Anthony Martin
Now make it an actual function like it says in the OP
Evan Morgan
how u put code in a box like this
#ImARetard
Leo Davis
Read the fucking sticky
Logan Lewis
I like the cut of your jib
Angel Gonzalez
static void Main(string[] args) { var input = Console.ReadLine(); Func isVowel = (char letter) => { return "aouieAOUIE".IndexOf(letter) != -1 ? true : false; }; for (int i = 0; i < input.Length; ++i) { if (char.IsLetter(input[i]) && !isVowel(input[i])) { input = input.Insert(i, input[i].ToString() + "O"); i += 2;
} } Console.WriteLine(input); }
Evan Richardson
OP solve your homework yourself faggot
Aiden Morales
Here come dat boii
Gabriel Price
static void ConsonantReplacementThingie() { string userInput = Console.ReadLine(); char[] vowels = new char[] { 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y' }; List uI = new List(); foreach (char item in userInput){ uI.Add(item); for (int i = 0; i < vowels.Length; i++){ if (item == vowels[i]){ uI.Add('o'); uI.Add(item);}}} string output = ""; foreach (char item in uI) output += item.ToString(); Console.WriteLine(output); }
Dylan Moore
What's the boob code?
Justin Hughes
...
Adam Kelly
I think OP's problems are too small to be homework. Are you a dropout?
Half of these can't into special chars or lower case convert :: String -> String convert = foldr go [] where go :: Char -> String -> String go c str | c `elem` nonVowels = c : toO c : c : str | otherwise = c : str
toO :: Char -> Char toO c | c `elem` ['B'..'Z'] = 'O' | otherwise = 'o'
-- short convert' :: String -> String convert'=foldr(\c cs->if c`elem`nVs then c:toO c:c:cs else c:cs) [] where nVs = filter(`notElem`"aAeEiIoOuU") (['b'..'z']++['B'..'Z']) toO c = if c`elem`['B'..'Z'] then 'O' else 'o'