![]() |
|
[Python] Pig Latin Translator - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: [Python] Pig Latin Translator (/Thread-Python-Pig-Latin-Translator) Pages:
1
2
|
[Python] Pig Latin Translator - Eclipse - 02-02-2014 Hey guys, I'm pretty new to Python so I wanted to share my very first creation! Code: pyg = 'ay'
word = original.lower()
first = original[0]
new_word = original + pyg
original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
if first == 'a' or first == 'e' or first == 'i' or first == 'o' or first == 'u':
print 'Translated: ' + new_word
else:
new_word = original[1:] + original[0] + pyg
print new_word
else:
print 'You didn\'t type anything!!'I'd love to hear any feedback!!! Thanks, Sparks RE: [Python] Pig Latin Translator - Equinox - 02-02-2014 Looks pretty cool. If I new pig latin I would use it. xD AND FINALLY. A thread in Python I did NOT make. It was getting a little lonely : P RE: [Python] Pig Latin Translator - Eclipse - 02-02-2014 (02-02-2014, 04:19 PM)Duubz Wrote: Looks pretty cool. If I new pig latin I would use it. xD Study the code and you'll get it! Thanks for the feedback. Lol, I'll be joining you. RE: [Python] Pig Latin Translator - Purphexyon - 02-02-2014 Me thinks this is pretty cool. Nice job
RE: [Python] Pig Latin Translator - Adorapuff - 02-02-2014 Isn't this a CodeAcademy level? RE: [Python] Pig Latin Translator - Eclipse - 02-02-2014 (02-02-2014, 05:01 PM)Adorapuff Wrote: Isn't this a CodeAcademy level? Yup ^-^ RE: [Python] Pig Latin Translator - Llebacc - 02-03-2014 Ah, the good ol' pig latin translator exercise. RE: [Python] Pig Latin Translator - Equinox - 02-03-2014 (02-02-2014, 03:38 PM)Sparks Wrote: Hey guys, This didn't exactly work for me and it's probably my Python version so I did some fixes specified for 3 and onward when they make newer versions. Code: #Probs to Sparks for creating original#
original = input("Enter a word: ")
pyg = 'ay'
word = original.lower()
first = original[0]
new_word = original + pyg
if len(original) > 0 and original.isalpha():
if first == 'a' or first == 'e' or first == 'i' or first == 'o' or first == 'u':
print("Translated: " + new_word)
else:
new_word = original[1:] + original[0] + pyg
print(new_word)
else:
print("You didn't type anything!!'")RE: [Python] Pig Latin Translator - Eclipse - 02-03-2014 (02-03-2014, 05:36 AM)Duubz Wrote: This didn't exactly work for me and it's probably my Python version so I did some fixes specified for 3 and onward when they make newer versions. Thanks for that! I see... I thought that bug that I had was to do with the program I was using... Thanks! RE: [Python] Pig Latin Translator - BreShiE - 02-03-2014 Nice work Sparks, but if you're going to post code, you should comment out your code to help others who want to learn. |