Thursday, 3 August 2017
python - Add the trailing characters upto the first first occurrence of a vowel to the end of the word
Answer
I don't think the heading quite explained it sufficiently.
Basically I have a list containing all of the vowels and another list containing the characters that make up the word.
I need to take the list containing the word and take all of the characters up to the first vowel and add them onto the end in order.
What I can't wrap my head around is how to do it, I had two ideas:
for characters in word:
if(character != vowel):
vCount += 1
else:
break
break
for i in range(vCount):
print(i)
wList.append(wList.pop(i))
And another that was basically the same but every time it saw it wasn't a vowel it pop'd it out. The obvious issue I didn't see with these initially is that 'vowel' isn't just a singular entity, character doesn't equal a, pop, character doesn't equal e, pop, etc etc. Or in the case of vCount, it just got far longer than the actual length of wList.
Anyone have a thought on how to solve this?
EDIT: Sorry, that wasnt clear:
cat -> atc
bear -> earb
casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV
In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...
-
Parse error: syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' ...
-
I'm using Simple HTML DOM to extract data from a HTML document, and I have a couple of issues that I need some help with. On the line th...
-
I upgraded IntelliJ Idea from 12.0.4 to 12.10. Now all the modules in my Android project give the error: Error: Default Activity Not Found ...
No comments:
Post a Comment