No, you should not leave. It is only a week we are talking about and you are likely to learn something in that time. If the problem was you getting harassed, picked on, or something similar then I would probably recommend leaving (as it is such a short time frame). However, in your case I would say that staying just for the sake of showing yourself that you can cope with less than perfect circumstances at work will be worth it. You will be proud of completing the internship and this sets a tone for you to build the rest of your career on.
If you want to work in any programming field (or any field) you are going to have to fight through jobs and times like these to get to where you want to be. Quitting will always be an option, but seldom the right one. Focus on your long term goals and you will find it easier to deal with the short term difficulties. As Cicero put it
"The wise man therefore always holds in these matters to this
principle of selection: he rejects pleasures to secure other greater
pleasures, or else he endures pains to avoid worse pains."
Meaning; the joy of having fought through your internship will be greater than the joy of not having to go to work next week.
Even if your expectations are not getting met it does not mean that the internship is useless. It is valuable to learn what you don't like and in what environments you can't work productively. This helps you later on with knowing what jobs fit you and what ones don't.
Your mentor not being helpful is also a valuable lesson. Not all people can or are willing to teach others. Asking well researched questions that show effort and that you have tried to find the answer will help increase the chances of getting help from your mentor.
Don't worry about completing all the tasks. As an intern over such a short time frame (and unpaid) it is not your responsibility, nor should it be their expectation that you complete everything on time. You need time to learn and this means you are a lot less efficient then their normal employees.
Hard coding tasks are good. Even if you are only able to complete one of those hard tasks or a function in one of those tasks it will teach you something and make you proud. I remember sending my first email with PHP, it took me 3 days (and even then it was still buggy) but I am still proud to this day that I stuck to it and was able to make it work.
Do not compare your work or work pace with that of your mentor. Your mentor will write better code and be about 10 to 100 times faster than you at it. This is how it is supposed to be. Don't feel bad that your code is not as good as theirs or that you cant keep up with their pace. As an intern or even a Junior Developer this is perfectly normal.
You can bring it up if you feel its worth it. Your mentor might not realize that he/she is not helpful or that you find the programming tasks too hard. Just choose your wording wisely here, avoid saying "You are not helping me!".
most of the coding tasks they threw at me are hard for me and I learn nothing from them
That seems to be a contradiction. If a task is hard, you should go out, do research, figure out how to solve it, and then learn. You do saymy mentor isn't supportive at all
, but I don't know what that means - are you making an effort to learn things and ask well-researched questions? You also mention thatI am supposed to be there for a month
- what is the purpose of this internship, from your perspective and the company's perspective? 1 month isn't long enough to contribute must at all.