Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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 68,423 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))