Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

New Journey
New Journey
1,082 Points

Please help me solve this in either Python or JavaScript with step by step explanation! :)

I figured it out! Thanks, guys :)

Chris Freeman
Chris Freeman
Treehouse Moderator 67,986 Points

You're missed the last step of the assignment: Write your function

Is this for a class assignment? I would be happy to "help" but first show what you've attempted by posting your code.

There are way too many request for solutions to homework problems. This is not the purpose of this forum. If you have s specific issue, you are stuck on some part, or are confused, please elaborate. There are many here would be more than happy to help.

If you simply want a solution, post back and we can see about finding a contractor you can pay to do your work for you. Good Luck!!!

1 Answer

Thomas Nilsen
Thomas Nilsen
14,957 Points

Here is a pseudo-code answer that should help you (in javascript).

var str = '0h2abe1zy';

function plainText(str) {
    var result = '';
    for(var i = 0; i < str.length; i++) {
        var s = str[i];
        if(s is a number) {
            increment i
        } else {
            add letter to result-variable
        }
    }
    return our result variable  
}

console.log(plainText(str))