Take the square root of every element of cups, rounded to 2 decimal places

NumPy · from Vectorisation and ufuncs

elementwise opsnp.sqrtnp.wherenp.maximum+=out=

Putting the kettle on…

Starting up…

Exercise 2

Take the square root of every element of cups, rounded to 2 decimal places.

your answer
stuck? the lesson behind it
Vectorisation and ufuncs
The loop doesn’t disappear — it moves somewhere much faster.