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...
-
The whole error output being: LNK2019 unresolved external symbol wWinMain referenced in function "int __cdecl __scrt_common_main_seh(vo...
-
I have come across CORS issues multiple times and can usually fix it but I want to really understand by seeing this from a MEAN stack paradi...
-
I recently used canvas to conert images to webp, using : const dataUrl = canvas.toDataURL('image/webp'); But this takes a lots of ti...
No comments:
Post a Comment