Laboratory 1: Getting startedPrerequisits: functions, import statements Additional learning resources: Contents Training preparations
This provides us a ”clean” IPython interpreter session (within Spyder). You should carry out these steps before every laboratory. You now have an IPython interpreter available and are encouraged to carry out basic mathematical operations at the iPython prompt (In [?]:). PrerequisitesYou should know how to compute simple expressions such as
You will need some of these expressions below, and you should be familiar with using the Python Shell to evaluate Python expressions. You should know how to use a Python development environment. Assuming you use Spyder, you should know how to
If necessary, go through the exercise First steps executing Python programs interactively which explains how to do this. Worked example
Python prompt notationAlthough we expect that you use IPython for these exercises, we will also provide examples of interacting with the Python prompt using the >>> prompt, as displayed in the normal Python console instead of the In [3] prompt displayed in the IPython console. The number in the IPython console, such as 3 in In [3], simply indicates the number of inputs in the current IPython session and has no other significance.
Python and IPython console — what is the difference?We also note that we will refer to the IPython console losely as the Python shell or Python console. In terms of the programming language, the IPython and Python shell can process the same command set. The IPython shell is more powerful in providing tools that help us, for example, to write and debug code efficiently. Laboratory 1 trainingNow, it is your turn. Please define the following functions in the file training1.py and make sure they behave as expected. You also should document them in a way similar to the average function.
Submit your fileFor every function try to check carefully that your implementation is correct. The tab Testing tips provides some suggestions in form of a short checklist. Once you have gone through the checklist and think your functions are implemented correctly, please send an email to the coursework submission robot learn@mpsd.mpg.de with subject training 1 and attach the training1.py file. You should soon (within a few minutes) get a a confirmation of the submission, and slightly later a report containing feedback through an automated analysis of your code. If the automated analysis says that some test failed, you can change your code and re-submit training1.py by emailing again to the same address. You can repeat this as often as you want. We urge you to improve and re-submit your work until you pass all tests. Ask the demonstrators for advice to interpret the error messages you may have received in your feedback email if tests have failed. Assessment of lab workIn future labs, there will be a training component and — what we call — an assessed component. For the training, you can submit your work as often as you like and get feedback on each iteration. It is generally crucial preparation and practice for the assessed parts. For the assessed part, you can submit your work only once and points will be awarded depending on how many functions you have implemented correctly. We encourage you to use the ‘training’ part to familiarise yourself with the topic (and to be creative if you like), and then to use that knowledge to attempt to get the ‘assessed’ part of the laboratory completely right. (Note: this course is not formally assessed - the automatic feedback is only for your information and to (hopefully) motivate you.) Last updated: 2024-12-19 at 15:57 |
|