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.

  • 3
    Do you understand what the program is supposed to do? Jul 23, 2018 at 5:35
  • 38
    Why do you need your professor to run the program? Can't you just run it on your machine and see if it works like intended? Jul 23, 2018 at 8:13
  • 6
    Stop worrying. You are already doing better than your friends if they can't even get a result. Do your best and you'll see how you did when the grades are returned.
    – user9482
    Jul 23, 2018 at 8:42
  • 2
    Did your professor offer sample inputs and the corresponding expected outputs? In my classes, we usually got at least some test cases for every assignment.
    – Polygnome
    Jul 23, 2018 at 10:14
  • 7
    Are you a graduate student in Computer Science or in some other field that simply uses programming. A lot of what is here doesn't make much sense without knowing that.
    – Buffy
    Jul 23, 2018 at 10:56

9 Answers 9


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.

  • 1
    @nikki2 if you have a set of inputs and a set of expected outputs, then you can use any online or offline compiler to actually run your code. tio.run can run most of the language and is used frequently on codegolf stack. Jul 23, 2018 at 11:20
  • 4
    I’ve had at least one instructor who explicitly recommended this approach to her students for a graded coursework, and I’ve had several instructors who allowed this (although there’d usually be limitations they’d give). As a tutor, I was willing (and permitted) to help students with their graded homework within reason. Jul 23, 2018 at 11:23
  • 13
    @nikki2 learning to check the validity of a program is a fundamental part of computer science, and something you should learn quickly. Additionally, you should attend office hours or arrange to meet with your professor in person to talk about the code conceptually if you don’t understand how to do the homework. Jul 23, 2018 at 14:11
  • 3
    -1. I've had instructors, both undergrad and graduate level, tell students if what they're doing is wrong and why. Homework shouldn't be a cryptic puzzle for students to decipher and be unsure of if there final product is correct or not. I see nothing wrong with OP going to the professor, explaining what they did (might include showing code), and asking the professor if that is what they wanted because it was unclear in the assignment description.
    – chevybow
    Jul 23, 2018 at 14:57
  • 3
    @chevybow Questions that clarify what the assignment asks (e.g., desired behavior in corner cases, output formatting, error handling, other constraints) are explicitly contemplated in my last sentence as always allowed. Some instructors (e.g., me) will help a student with debug. Jul 23, 2018 at 15:22

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.

  • 2
    Nitpicking: "too localized" has been removed as a close reason, and IIRC there never has been a "lacking prior research" close reason, that was always just a reason to downvote.
    – jrh
    Jul 23, 2018 at 15:09
  • 3
    @jrh: That said, SO aggressively closes questions of the form "My code does not work" which do not contain any code.
    – Kevin
    Jul 23, 2018 at 23:03

There are two cases to consider:

  1. 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.

  2. 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.

  • 3
    I don't think unit testing is something first term students are expected to know or understand. What exactly an object is, is difficult enough for them.
    – Belle
    Jul 23, 2018 at 8:48
  • 3
    @Belle-Sophie Unit testing is not limited to classes, although a class is a natural unit in OO programming. It can be a function. It can be a data structure and some functions that operate on it. Jul 23, 2018 at 9:50
  • 3
    The OP is a graduate student. I hope grad students have been exposed to unit testing. Jul 23, 2018 at 13:08
  • 3
    I hope grad students have been exposed to unit testing, and assumed the OP would know about it, but testing and debug do seem to be neglected topics in some programming education. Jul 23, 2018 at 13:28
  • 4
    That is, if the previous studies contained programming at all
    – Belle
    Jul 23, 2018 at 13:53

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'm not sure what you mean with the "not fair" thing; Surely if the option to have something checked in advance is an option for some students, you'd allow it for all of them? If some students do not take advantage of such an option that's on them.
    – Cubic
    Jul 23, 2018 at 15:57
  • 4
    @Cubic It's not fair because he doesn't have the time to do it for all of them. And since the fair thing to do is if he does it for some to offer it for all, and he can't do it for all, the only fair thing to do is to do it for none. Jul 23, 2018 at 19:55
  • There are at least two possible reasons they might want to do this. (1) They write well, or at least reasonably well, and want to make absolutely sure they get an A. (2) They are completely clueless about how to write, and really need help. I don't have much sympathy for those students who fall under case (1). But you really should make sure that those students that fall under case (2) are somehow able to get some help. Otherwise, they'll never learn to write, and isn't that one of the things you're supposed to be teaching them? Jul 24, 2018 at 17:01
  • Ditto for programming, but here, it looks like the OP probably falls in case (1). Jul 24, 2018 at 17:04

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.

  • I assumed the ML difficulties would not apply because the question said "run them to see whether I did them right or not" indicating that simple tests would work. Jul 23, 2018 at 15:12
  • @PatriciaShanahan unless that statement really meant "run them and receive results that fit the model". I know in my graduate coursework, learning to code was much easier (though I came from an IT professional background) then learning to interpret and explain results. Until the OP adds some background on the type of program, it is hard to understand what the problem is (and thereby what to do). Fyi., I read this and assumed it was a problem of picking good plots and checking goodness of fit. Like a question I remember asking once was "are low R-squared values bad?" thinking my code was bad. Jul 23, 2018 at 17:46

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .