Skip to content

Commit

Permalink
simple_pig_latin
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan authored and Hakan committed Jul 16, 2020
1 parent aaaf0d7 commit ab58893
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 028_simple_pig_latin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# text = 'Pig latin is cool' # igPay atinlay siay oolcay
# pig_it = 'Hello world !' # elloHay orldway !

# pig_l= pig_it.split()
# new_pig_l = []
# for i in pig_l:
# if len(i)!=1:
# i = i[1:] + i[0] +"ay"
# new_pig_l.append(i)
# else:
# new_pig_l.append(i)
# pig_it = " ".join(new_pig_l)



def pig_it(text):
pig_l= text.split()
return " ".join([i[1:]+i[0] + 'ay' if i!="?" and i!="!" else i for i in pig_l])




# def pig_it(text):
# lst = text.split()
# return ' '.join( [word[1:] + word[:1] + 'ay' if word.isalpha() else word for word in lst])

0 comments on commit ab58893

Please sign in to comment.