Reasons why we prefer '.ipynb' instead of '.py' while learning data analysis:

Table of contents

No heading

No headings in the article.

if you run a python code:

import tensorflow as tf
print(tf.__version__)
hello = tf.constant("Hello")
print(hello)

in .py file,The output will be like this:

"2023-01-25 13:15:51.190586: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. tf.Tensor(b'Hello', shape=(), dtype=string)"

and if you use .ipynb file output will be like this:

tf.Tensor(b'Hello', shape=(), dtype=string)

so you can see the difference, .py output is messed up whereas .ipynb is more clear. so this is one of the reasons I found for preferring .ipynb instead of .py. please tell me more in the comments if you know.