I have got assignments related to programming. They are tough and my friends could not get results. I wanted to ask my professor to run them to see whether I did them right or not. (the deadline is rapidly coming.) I am a graduate student. It is my first term.
Most instructors will refuse to check your homework for you before you turn it in. You get it graded once and only once. There are no do-overs where you get to turn it in the first time, they point out your mistakes, then you get to turn it in again after you've corrected it.
If you're confused, you can ask clarifying questions about what the homework asks (e.g., desired behavior in corner cases, output formatting, error handling, other constraints and anything else that seems ambiguous) and about the underlying material (e.g., an algorithm discussed in lecture that you need to apply) but not about the correct answer or whether your answer is okay. Some instructors (e.g., me) will help a student with debug, but usually only to help you learn the skills involved. They usually will not debug your program for you.
As Nicole correctly points out, most instructors won't be able or willing to "pre-grade" homework, but some may. So if you feel strongly about it, you can certainly ask.
That said, it's probably more fruitful to ask one or more targeted question(s) about the things that you are unsure about. Note that "please run my program and tell me if it works" isn't a targeted question, nor is "here is my code, will I get all points for this". A targeted question may include a succinct summary of your approach and the parts that you are unsure about, and asking if you are on the right track. I imagine that most instructors will be more than willing to give you feedback on that.
As a rule of thumb: if a question would be closed on Stack Exchange (particularly, if it would be closed as lacking prior research or being too localized), there is a good chance that an instructor would also not be happy about it. Incidentally, this is one of the core reasons why I strongly support my students being active on Stack Exchange - it trains them how to productively ask for feedback better than any other way that I know of.
There are two cases to consider:
You do not understand what the program is supposed to do. In this case it is appropriate to ask the professor questions of the form "What should happen in this case?" or similar.
You do understand what the program is supposed to do. The way you make sure you are doing it right is a combination of desk checking and testing. Remember to unit-test non-trivial modules, as well as testing the whole program.
Testing is part of the work of programming. It is not reasonable to expect your professor to do it for you.
Depends on the professor. My policy was always something like this:
- You want me to read your paper, comment on it, point out all the places it could be strengthened, and essentially grade it—BEFORE I actually grade it?
- (Generally, when students get such a paper back, they then expect they will get an A on said paper. Generally, they will not, because there are probably still flaw or such with the paper. My job in grading is not to rewrite the paper but to assess what's in front of me and point out the largest issues. Those issues rarely are merely technical fixes, although students treat them as such.)
My answer was "no." Grading once is bad enough. Grading twice is more torturous and not fair to the other students in the class who didn't get a double grading.
I was in your situation in the Fall. I found that if I went to my professor early on in the assignment with very specific questions, they were generally more than happy to offer some guidance. They wouldn't "pre-grade" but they would try to point me in the right direction. Questions like "why isn't this working" are not appropriate, but a more pointed question such as "I have done x, y, and z. I am struggling with this part. I have tried these methods and these are the results I've gotten. I know this isn't correct because... Do you have suggestions or any places to look for some guidance? I have reviewed the class materials but still haven't been able to find any successful solutions." This demonstrates to the professor that you have made several valid attempts while also showing that you are able to understand why your problem-solving attempts have been unsuccessful. If you phrase it in a way that makes it clear that you have exhausted all resources, have not procrastinated to the last minute, and are not asking them to give you the answer, you are much more likely to get some form of assistance. If you and your classmates have all discussed the assignment and still cannot come with any solutions, having multiple people reach out to the professor is always helpful. The professor can then see that either they need to offer clearer instructions or spend more time on certain areas.
I generally take a contrary approach to most answers here. When I set up assignments (usually in Blackboard), I set the number of allowed submissions (usually to three). I also give the students an undertaking that I will try to mark any early submissions as soon as I can, subject to my other work constraints.
My take is that:
From the students' viewpoint:
- They get time-bound specific feedback on their work.
- If they really screwed up, they don't get penalized from a one-off mistake. Several of my students do not have English as their first language, so miscommunications do happen.
- They have a good chance at getting 100% on all such submitted work.
From my viewpoint:
- I get a larger time period to mark the assignments, because students don't wait until the last minute to submit.
- I get to identify problems a little earlier and address them with the whole class before the due date.
- Marking updates to assignments takes way less time than the initial marking, so the extra time is not of huge significance.
- I see re-doing the assignment as a form of repetition on the material, which I believe is good for their learning outcomes.
My overall aim is to have the students learn the material. Forcing "one shot" submissions can be counter-productive to this aim.
Note that this is aimed specifically at in-term assignments and quizzes. Midterms and finals don't get early submissions or retakes.
You don't say here, and it makes things difficult, but elsewhere on the site you indicate that your field is AI and in particular Machine Learning. If this course is, indeed, about Machine Learning, I can understand the state you are in.
Any student who has an undergraduate CS degree should be able to write just about any program in a language that they already know. Every such student should also be familiar with common methodologies such as unit testing. However, perhaps your background is somewhat different, making it difficult to assume that knowledge.
Since you say that your classmates are in a similar state, I have to guess that there is something fundamentally new about this to everyone.
If your "program" is in a new language and the subject is machine learning, in which the "evidence" of success of the learning is something fundamentally different from, say, implementing a standard algorithm with well defined initial and final state, then I can also understand the difficulty.
If this is the case, then it might be useful for the professor to know that everyone is having difficulty with it and to seek a bit more guidance about what to expect. You don't need to ask for a pre-grading analysis to do this, however. In a big enough class, perhaps the professor has an assistant who can provide appropriate help (with the knowledge of the prof, of course). Or he/she may just be willing to say a bit in class, if asked, that will give you assurance that you are on the right track or have gone astray.
If I've misinterpreted, I apologize, but it would be good if, either in your questions or in your profile, that you give a bit more background about your actual situation.
And a note to everyone here. If I've made the correct assumptions, note that AI/MachineLearning is a bit different than other CS topics in that, while the input state can be specified precisely, the final state may not be in many cases. In fact, DARPA just started a program to build AIs that could actually explain their output. This is a new thing, in fact and one of the traditional difficulties in AI. They can come to "conclusion" but can't say why.
Let me add a bit about languages. If you are a Java programmer, say, you should be able to write a competent program in Python with only a bit of prodding and practice. However, if the new language is Scheme or Haskell, or a specially tailored language, then the learning curve is quite a bit steeper, since they come from quite different paradigms. Different paradigms require different thought processes, not just different syntax.
The only way to be sure would be to send your professor an email asking. My guess would support what other answers have been telling you.
Making sure you fully understand the assignment is also a good idea (meaning, what does this assignment look like/run like when it's done properly?), but also ask your professor about where to get help. He or she is probably aware that this isn't easy stuff. The prof will probably explain how much he or she is willing to help, and maybe have a list of tutors or resources where you actually can get specific help.
Just another note, be super careful about getting coding assistance (which is why it's a good idea to ask the prof where to get help). Be extremely clear on what your prof considers plagiarism. Asking friends about their code that worked and copying it could get you in big trouble.
Does your professor (or any of their TAs) have open office hours? I imagine if you go in, show them the program, and tell them you're confused about whether it's working as intended, they'd be more than happy to help.