This really depends on the exercise/ how it's being taught. If the lesson begins with a starter code and then has a number of tasks you need to do to complete the piece, then by all means type it out. However, if you are being given a large file that does what it needs to, then typing it out might not be effective.
You're learning the process of building something. Start with the foundation and work up. Learn how to read the code and what each line does. Ask yourself if you could build the project on your own up to where the tutorial is without using the tut as a resource. If you can, great! Do it yourself and use the tut to guide you to what to do next.