Pyg latin end of unit problem


#1

Hi,

I recently finished the unit on Pyg Latin, only the problem is I think my code is incomplete and I can't find the solution. I can't figure how to tell my program to check if it is a consonant or a vowel. Therefore when I enter the word Hello it is not returning me ellohay but helloay because it is not calling the "else". Can you help ?

Here is my code :

pyg = 'ay'

original = raw_input('Entrez un mot :')

if len(original) > 0 and original.isalpha():
mot = original.lower()
nouveau_mot = mot + pyg
print nouveau_mot
else:
mot = original.lower()
nouveau_mot = mot[1:] + mot[0] + pyg
print nouveau_mot

premiere = mot[0]

Thanks and have a nice day !


#2

Try this...

I typed Python to print 'ythonpay'. Therefore, I used
new_word = word[1:7] + the variables I had created as it was instructed

It worked!!! Hope this help.


#3

Yep thanks for the help but this is not quite what I am looking for sorry.... Because if I type Python with my program, only the "if" statement will work instead of the "else" statement.


#4

try dis code..

syntax of if statement z wrong in ua code...jz chk it..


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.