From f24db235339f731e5eb158a24dbfdef3f8f4525b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Sand=20Jensen?= <bjje@dtu.dk> Date: Thu, 30 Jan 2025 20:14:33 +0100 Subject: [PATCH] Updated structure of lecture plan and file names (needs to be double checked) --- exercises/02450Toolbox_Python/Scripts/check_installation.py | 4 ++-- exercises/02450Toolbox_Python/Scripts/ex0_4_5.py | 5 +++-- exercises/02450Toolbox_Python/Scripts/ex0_5_1.py | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/exercises/02450Toolbox_Python/Scripts/check_installation.py b/exercises/02450Toolbox_Python/Scripts/check_installation.py index 0247d0d..6940c23 100644 --- a/exercises/02450Toolbox_Python/Scripts/check_installation.py +++ b/exercises/02450Toolbox_Python/Scripts/check_installation.py @@ -16,7 +16,7 @@ print('Current working directory {}.'.format(pathlib.Path().resolve())) print('') print('The numpy version is {}.'.format(np.__version__)) print('The scikit-learn version is {}.'.format(sklearn.__version__)) -print('The torch version is{}.'.format(torch.__version__)) +print('The torch version is {}.'.format(torch.__version__)) """ Check that the course specific tools can be imported @@ -25,7 +25,7 @@ import dtuimldmtools print('The dtuimldmtools package {}.'.format(dtuimldmtools)) """ -Check that pandas can be imported (use in ex1) +Check that pandas can be imported (used in ex1) Note_ If this fails you need to install panda manually https://pandas.pydata.org/docs/getting_started/install.html diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py b/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py index 0884bcf..3e55c20 100644 --- a/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py +++ b/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py @@ -18,9 +18,10 @@ x = np.asmatrix(np.arange(1, 6)) y = np.asmatrix(np.arange(2, 12, 2)) # Again, have a look at them by typing 'x' and 'y' in the console -# Try using the * operator just as before now: +# Try using the * operator just as before now (this should not work!): x * y -# You should now get an error - try to explain why. +# You should now get an error - try to explain why +# (comment or remove the line to run the rest of the script). # array and matrix are two data structures added by NumPy package to the list of # basic data structures in Python (lists, tuples, sets). We shall use both diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py b/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py index 6cb5ce8..1fcf0ad 100644 --- a/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py +++ b/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py @@ -5,9 +5,12 @@ import numpy as np x = np.arange(0, 1, 0.1) f = np.exp(x) + plt.figure(1) plt.plot(x, f) plt.xlabel("x") plt.ylabel("f(x)=exp(x)") plt.title("The exponential function") plt.show() + +# %% -- GitLab