{% import macros as m with context %} .. _ex0: .. role:: python(code) :language: python .. role:: bash(code) :language: bash Exercise 0: Installation and self-test ================================================================================================= The purpose of this exercise is to install the software toolbox, set up your python development environment, and allow you to create a handin using our evaluation system *Unitgrade*. It is strongly recommended you create (and upload) the handin to DTU Learn, as it will ensure you won't have technical problems with the reports. Complete the following steps: - :fas:`1` Complete the :ref:`installation` - :fas:`2` Download the :asset:`description of the exercises <02465ex0_Python.pdf>` and complete as many as you like - :fas:`3` Create the :file:`.token`-file and upload it to DTU Learn (:ref:`see below `) .. _createtoken: Testing your code and handing in ----------------------------------------------------------------------------------------------------------------- {{ m.embed('https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=80f30d3b-d27e-4a6a-acee-b103014145eb', 'Solving and testing the exercises', False) }} This course will use a software tool called unitgrade for handing in project solutions. Unitgrade is build on top of pythons unittest framework, which is the industry-standard way of testing and verifying python code. It is up to you if you want to use unittests to test and debug your code, or if you only want to use unitgrade to create a handin. This section will show both approaches using the fruit-homework as an example. Solve problems and running unittests ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the recommended way to run the script. In VS Code, simply click on the testing flask (see the above video), and run the tests you wish to run. The tests will call your functions with different input and compare it to the expected output. Notice that you can always see how your functions are called, and therefore I recommend you use this approach when you are working on solving your problems. Creating your hand-in token-file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ {{ m.embed('https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=09d5ea0a-35b4-4b81-86c0-b103015071f8', 'Creating your hand-in', False) }} To create your hand-in, you have to use the :file:`fruit_project_grade.py`-file. This file contains the same tests as you ran using the previous methods but without any risk of accidentally changing the test script. You can run the file the same way you would run any other file in python or by using the command .. code-block:: bash python -m irlc.project0.fruit_project_grade Either way, you will notice the script produces a file called .. code-block:: bash irlc/project0/FruitReport_handin_70_of_70.token The numbers are the points you obtained. You should hand in this file without modifications. The file contains a copy of the source code you have written. Note the points are only indicative of how well you did on the public tests.