Quick question with NumPy project. [Betty's Bakery]

I was completing the project in the NumPy module named Betty’s Bakery, and I watched the video just to make sure that I did things correctly, I noticed the coder used the print statement but didn’t use the parentheses around what he wanted to print. I went back to my code and removed the parentheses and the print statement still worked. I was under the assumption that Python is very literal and you would get an error if you didn’t use the syntax exactly as you were supposed to. Is this a NumPy feature? We also used operators to add lists without parentheses also so I was figuring it had something to do with NumPy. Just wondering for wondering sake.

Some of the CC modules are still under python 2 (I think the free content ones). This type of print is deprecated in python 3 so it’s good to not use it moving forward.


Yep, that content is from at least 2018 (when it was part of a data analytics intensive that I took) and is in 2.7.

3.8.5 is the latest version of Python.

Definitely nothing to do with numpy. I think most of the lessons (even those based on Python 2) import print from the futures module anyway so you can use print() as a function. Whilst you can use the print statement, e.g. print 'test', in those lessons it’s fairly common to just import the function anyway so you might find it easier to just do the same.