Trying to create a program to translate string to pig Latin. Please help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Trying to create a program to translate string to pig Latin. Please help!

How do I make what I’m trying to do, apply to every word in the string? I’ve been messing around with different indexes but I can’t figure it out. My code: https://sololearn.com/compiler-playground/c69aUikdF68X/?ref=app

7th Oct 2023, 7:55 PM
Josh Rhodes
2 Answers
+ 4
Play with the code and try to find out how this work. That is similary to a list.
7th Oct 2023, 9:05 PM
JaScript
JaScript - avatar
+ 1
Josh Rhodes, I recognize your name these days and you are asking more than 1 code coach question in a day. Try to solve the easy questions first then move on to the medium, no jumping around. Starting from easy builds your experience, and gets better knowledge how the functions work. Back to your question, each word has to be transformed into pig Latin. To accomplish this you can loop through the words as JaScript already gave you a hint. Indexing is not relevant here. Also take a closer look to the task description, what the input contains or NOT contains, then split the words correctly. After the words are split you can manipulate each word individually in a loop.
8th Oct 2023, 2:27 AM
Wong Hei Ming
Wong Hei Ming - avatar