Jupyter Notebooks:

  • Jupyter Notebooks represent a powerful way of integrating the core programming capabilities of Python with additional information to document analyses and display figures summarizing the results of calculations.
  • Alternative to the Python and IPython interpreters as a way to run Python code.
  • Allows you to not just run code, but also to integrate graphics and documentation and other forms of interaction.
  • Jupyter Notebooks have become a dominant mode of communication within the field of data analytics and data science.

The Relationship Between Jupyter Notebooks and Python Source Code:

  • Jupyter Notebooks contain much more than just Python code and define a different file format for storing code, documentation text, and figures.
  • For the most part, you will just be accessing Jupyter Notebooks (ending with suffix .ipynb, short for “IPython notebook”) in VS Code or Google Colab. However, it is useful to understand that these files are different than the Python source code files that you create (ending in .py).
  • The main difference between the two formats is that we’re essentially embedding Python source code in this other data format.

Practice the following using Jupyter Notebooks in VS Code or Google Colab:

  • Define a variable named time_24 and assign it a value of 11.
  • Create an If Statement that use the following logic:
    • If the time is less than 12, display Good Morning!
    • If the time is less than 18, display Good Afternoon!
    • If the time is less than or equal to 24, display Good Evening!
    • Otherwise, display Time must be between 0 and 24!
python
1time_24 = 11
2
3if time_24 < 12:
4    print("Good Morning!")
5elif time_24 < 18:
6    print("Good Afternoon!")
7elif time_24 <= 24:
8    print("Good Evening!")
9else:
10    print("Time must be between 0 and 24!")