Another alternative to copying entire programs wholesale is to google individual techniques; a lot of times I would look up "How do I... in [language]". A site like stackoverflow for example will often show several different approaches.
This next approach isn't for everyone but I try to do the challenges with only the code I've learned up to that point; if I've forgotten how to do something or can't figure out an error I either return to the relevant lesson or look up the syntax/error. I feel like this helps me to internalize the current lessons and potentially see more "creative" uses for them.
As a next step I might look into more advanced techniques or functions that are already included in the language to "learn ahead" as it were, or go back to old challenges after doing future lessons to see if I'd make any changes.