Frequently asked questionsOverview
About the autotesting systemGeneral infoAfter having emailed your work to the module email account python4computing@gmail.com, you should get
If there are no queues in email delivery, you should expect to have a reply within two minutes back in your inbox. Any error messages you might get in your feedback email, will refer to functions in a module space s, for example s.log2(): the s stands for student or submission, i.e. the file you submitted has been imported as s into the testing script. In the training parts of the practical work, you can re-submit your files as often as you like. We encourage you to make use of this opportunity to check your skills, and as preparation for the lab-assignments and the class room tests. You may find the introduction to understanding the feedback messages from the system useful. If, after reading this page, you need help to interpret the messages that the feedback the system provides, please do ask a demonstrator. Problems?Please report any feedback or error messages that seem not to make sense or be plain wrong to us. When should I get an email reply?Normally, any incoming emails will be parsed within 60 seconds after the email has been delivered to the account. The autotesting will start about 60 seconds later, so that a turn-around time of 3 minutes can be expected if email delivery is quick. Very occasionally, there may be severe delays in the delivery of emails across the university, and this will affect the autotesting system. If you do not receive a reply where you think you should have received on, it is recommended that you try to send a test email to yourself. If this email does not appear in your inbox, then there is a problem with the email delivery. There is nothing we can do about this, and your email to the testing system and the reply is probably underway. Grab a snickers and wait (or use the time in any other constructive way). If, on the other hand, the email from yourself to yourself comes to your inbox straightaway, this might point to a problem with the autotesting system. In this case, please inform Dr Ondrej Hovorka (feeg1001help@soton.ac.uk) asap. The email I receive looks strangely formatted - is that correct?The emails that the system sends out are plain text (i.e. not html or any other mark up language). They will look best if displayed using a monospaced font, i.e. one where each character has the same width. Suitable fonts include Courier, New Courier and Monaco. What does the '{Disarmed}' message mean?If you get replies back from the submission system that read similar to: an error occured while parsing your email with subject '{Disarmed} lab2' received at Wed Oct 10 16:55:02 2012: The subject line of your email could not be parsed by the system. then some part of the (university's) emailing system thought that your email contains a virus (maybe in an attached file). It would then remove the potentially dangerous file, and change the subject line to include the note '{Disarmed}'. The autotesting system does not know what to do with the new subject line, which is now '{Disparmed} lab2' instead of the desired 'lab2', and it issues the error message show above as a reply. (Note that we could teach it to ignore the '{Disarmed}' string in the subject line but the attached file would have been removed from the email at the moment the '{Disarmed}' message is added, so the testing system would never see that submission file anyway, and wouldn't be able to proceed.) One reason for a virus to be suspected is if the file name of the attachment has multiple dots, i.e. lab2.py.py instead of lab2.py. Another reason seems to be the use of Google Chrome as the browser for the email client. If you run into this problem and are using Chrome, try Firefox or MS Explorer. If I add extra code to my functions that improves functionality, will the autotesting system mark it down?We generally recommend not to add any functionality beyond what is asked. Students often like to catch input arguments that are illegal. For example for a question working out the area of a triangle given the three edge lengths a, b and c, there are combinations of edge lengths that cannot form a triangle, such as a=3, b=1, c=1). It may appear initially to be a good idea to identify these cases and print something like "Illegal input, a, b and c cannot form a triangle" and return some special number or object. However, this is generally not a good idea. The Pythonic way to deal with these problems is to let the error occur (for example an exception ValueError: math domain error may be raised for the illegal input above). At some point during the course you will learn how to catch that exception at a higher level, where typically we know better what to do with it: we may want to ask the user for new input, we way want to print a particular error message, or we may simply ignore the error and carry on. Be assured that we will generally not call your function with illegal input for testing purposes, and if we do so, then it will be fine for your code to fail (i.e. in the example above it is okay if your code reports the ValueError exception). I can think of two ways to solve a given exercise -- which one should I take?Occasionally you may identify an exercise where you can either (i) program a solution yourself, or (ii) remember and use some in-built Python functions that make it easier/faster to write your solution. As long as the resulting functionality covers what you are asked to do, either version should pass the tests. (If you think this isn't the case, please get in touch with demonstrators/Dr Ondrej Hovorka (feeg1001help@soton.ac.uk). Our advice is: if you can think of two different ways of solving a particular problem, then try to do both. This will give you the best preparation for real-world programming/numerical work when you need it later (and also for the exam). OtherCan I start a Python or an IPython prompt inside my Python program?This is useful to inspect objects interactively at some particular point, say inside a function. Because this is within the local namespace of the function, we would not be able to inspect the objects knows there from the IPython prompt after using run. The easiest way is to start what is called an embedded IPYthon shell. The command is embed() and needs to be imported from IPython. Here is an example in file faq-example-embed.py: def mybuggyfunction(x): y = x * 2 z = y / (1 / 0.5) x = y + z # what is z here? And x? # Assume I don't know and want to check # with Python shell. Could do from IPython import embed embed() print("At end of function") return x + y + z mybuggyfunction(42) # main program Note that IPython's embed function does not work if the program is started within IPython (i.e. need to use the normal Python console, or python faq-example-embed.py to start it.) Example usage: fangohr$ python faq-example-embed.py Python 2.7.3 |EPD 7.3-1 (32-bit)| (default, Apr 12 2012, 11:28:34) Type "copyright", "credits" or "license" for more information. IPython 0.12.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: x # can check values in local namespace Out[1]: 126.0 In [2]: y Out[2]: 84 In [3]: z Out[3]: 42.0 In [4]: x+y+z # can evaluate Python expressions as normal Out[4]: 252.0 In [5]: exit # to leave IPython session At end of function # our program carries on |
|