Hi, I'm quite new to python .
I have written a pigLatin code and I need the code to ignore non characters i.e. I want them to stay where they are in a string. So for instance take '1myth' when this is converted to piglatin I want it to be for example 1ythmway where the number is not affected
Here is my code below :
I realised my code had an error so i have updated it below:
I have written a pigLatin code and I need the code to ignore non characters i.e. I want them to stay where they are in a string. So for instance take '1myth' when this is converted to piglatin I want it to be for example 1ythmway where the number is not affected
Here is my code below :
Vowels =("aeiouAEIOU")
y = input("\n Enter sentence ")
x = y.split()
for word in x:
if word[0] in Vowels:
word +='hay'
elif all(char not in Vowels for char in word):
word = word[1:] + word[0]
word += 'way'
elif a[0] not in Vowels:
for i, j in enumerate(a):
if j in Vowels:break
word = a[i:] + a[:i]
word += 'ay'
print(word, end = ' ')I realised my code had an error so i have updated it below:
Vowels =("aeiouAEIOU")
y = input("\n Enter sentence ")
x = y.split()
for word in x:
if word[0] in Vowels:
word +='hay'
elif all(char not in Vowels for char in word):
word = word[1:] + word[0]
word += 'way'
elif word[0] not in Vowels:
for i, j in enumerate(word):
if j in Vowels:break
word = word[i:] + word[:i]
word += 'ay'
print(word, end = ' ')
