Is there a way I can use an if function to determine if the first letter of a string is a vowel and if not, then print something else?
I've done quite a bit of research and the answers I found were too far advanced for me to understand. This is a small challenge I've handed myself that is based off of CodeAcademy's 'Pyg Latin' Translator
translate = input("Translate: ") cons = "ay" vowel = "way" if len(translate) > 0: switch = str(translate) if str(translate) != "a, e, i, o, u": new_word = str(translate) + str(switch) + str(cons) print (new_word.lower()) else: new_word = str(translate) + str(vowel) print (new_word.lower()) else: print("Please type something")
The job is to add "Way" or "Ay" depending on whether 'translate' begins with a vowel. I feel as though i'm skipping over something completely obvious but I can't figure it out. The program is pretty much ignoring line 6, Jordan comes out as Jordanjay Andrew comes out as Andrewaay