meinardmueller / pcp Goto Github PK
View Code? Open in Web Editor NEWPreparation Course Python Notebooks
License: Other
Preparation Course Python Notebooks
License: Other
In the recent versions of the Python documentation, the options that are emphasized for string formatting are:
str.format
method,The printf-style %-based method is only briefly mentionned and referred to as "old-style formatting". (See https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals.)
While the feature is not formally deprecated, I'd rather have students learn f-strings instead of printf-style formatting, as in:
>>> string = f'x = {x}'
(I would not use the recent syntax string = f'{x = }'
in such a course, but YMMV). Of course, since this preparation course is not meant to be comprehensive, if the f-string approach is considered too heavy, the 3rd option (concatenation) could be an option too:
>>> string = 'x = ' + str(x)
Problem description:
Binder fails building our environment with the following error:
package nbconvert-5.6.0-py27_1 requires python >=2.7,<2.8.0a0, but none of the providers can be installed
This is strange because we fix python=3.7.*
in our environment, but it seems to load a python=2.7
version of the package.
Unit 3 states that row vectors and columns vectors are special cases of matrices (with either 1 column or 1 row). While this is also how I see things, however idiomatic NumPy code would probably represent matrices as 2D arrays but row and column vectors as 1D arrays. The same object can then be interpreted and used as a row or column vector in different contexts.
Instead of
>>> A = np.array([[0, 1], [2, 3]])
>>> x = np.array([[4], [5]])
>>> y = np.array([[6, 7]])
>>> np.dot(A, x)
array([[ 5],
[23]])
>>> y.dot(A)
array([[14, 27]])
>>> np.dot(y, A)
array([[14, 27]])
>>> np.dot(y, x)
array([[59]])
>>> np.dot(x, y)
array([[24, 28],
[30, 35]])
one would generally do
>>> A = np.array([[0, 1], [2, 3]])
>>> x = np.array([4, 5])
>>> y = np.array([6, 7])
>>> np.dot(A, x)
array([ 5, 23])
>>> np.dot(y, A)
array([14, 27])
>>> np.dot(y, x)
59
>>> np.outer(x, y)
array([[24, 28],
[30, 35]])
I'd rather see that latter kind of idiom used (and have the solution of exercise 2 updated accordingly).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.