chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average
Thread Closed 


[Python] Pig Latin Translator filter_list
Author
Message
[Python] Pig Latin Translator #1
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 #2
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 #3
(02-02-2014, 04:19 PM)Duubz Wrote: 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

Study the code and you'll get it! Thanks for the feedback.

Lol, I'll be joining you.


RE: [Python] Pig Latin Translator #4
Me thinks this is pretty cool. Nice job Smile
[Image: b3f0a97bdadd6fe3f12f4c4e28584085_zpsbfbc8c42.png]


RE: [Python] Pig Latin Translator #5
Isn't this a CodeAcademy level?
#MakeSinisterlySexyAgain


RE: [Python] Pig Latin Translator #6
(02-02-2014, 05:01 PM)Adorapuff Wrote: Isn't this a CodeAcademy level?

Yup ^-^


RE: [Python] Pig Latin Translator #7
Ah, the good ol' pig latin translator exercise.


RE: [Python] Pig Latin Translator #8
(02-02-2014, 03:38 PM)Sparks Wrote: 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


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 #9
(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.

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!!'")

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 #10
Nice work Sparks, but if you're going to post code, you should comment out your code to help others who want to learn.
[Image: F4Z9Dqw.png]







Users browsing this thread: 1 Guest(s)