online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
''' Write a function pig_it that on the given text, moves the first letter of each word to the end of it, then adds "ay" to the end of the word. It must leave punctuation marks untouched. Examples: pig_it('Pig latin is cool') returns: igPay atinlay siay oolcay pig_it('Hello world !') returns: elloHay orldway ! ''' punctuation_marks = ',.!?:;' suffix = 'ay' def pig_it(text): pigged_words = [] words = text.split() for w in words: is_punctuation_mark = w in punctuation_marks if is_punctuation_mark: pigged_w = w else: pigged_w = w[1:] + w[0] + suffix pigged_words.append(pigged_w) pigged_text = ' '.join(pigged_words) return pigged_text def pig_it(text): pigged_words = [] for w in text.split(): if w in punctuation_marks: pigged_w = w else: pigged_w = w[1:] + w[0] + suffix pigged_words.append(pigged_w) return ' '.join(pigged_words) def pig_it(text): pigged_words = [] for w in text.split(): pigged_w = w if w in punctuation_marks else w[1:] + w[0] + suffix pigged_words.append(pigged_w) return ' '.join(pigged_words) def pig_it(text): pigged_words = [] for w in text.split(): pigged_words.append(w if w in punctuation_marks else w[1:] + w[0] + suffix) return ' '.join(pigged_words) def pig_it(text): pigged_words = [w if w in punctuation_marks else w[1:] + w[0] + suffix for w in text.split()] return ' '.join(pigged_words) def pig_it(text): return ' '.join([w if w in punctuation_marks else w[1:] + w[0] + suffix for w in text.split()]) def pig_it(text): return ' '.join(w if w in punctuation_marks else w[1:] + w[0] + suffix for w in text.split()) def pig_it(text): return ' '.join(w if w in punctuation_marks else w[1:] + w[0] + suffix for w in text.split()) pig_it = lambda text: ' '.join(w if w in punctuation_marks else w[1:] + w[0] + suffix for w in text.split()) def test(): table = ( ('', ''), (';', ';'), ('; . , :', '; . , :'), ('a', 'aay'), ('Pig latin is cool', 'igPay atinlay siay oolcay'), ('Hello world !', 'elloHay orldway !'), ) for text, expected in table: pigged_text = pig_it(text) print(f'{pigged_text = }, {pigged_text == expected = }') test()

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue