Don't already have an account? Create an account.
By creating an Ordinary Coders account, you agree to Ordinary Coders' Terms and Conditions.
If you already have an account, login instead.
Post a Comment
Join the community
What is a Jupyter Notebook?
A Jupyter Notebook is an interactive page that allows users to code in Python and view the output. Notebooks are divided into cells which can be run with Shift + Enter to display their output below. In education and industry, Jupyter Notebooks are commonly used to teach Python and data science since the format helps users understand and visualize their code in a step-by-step fashion.
Follow us @ordinarycoders
Now that you have created your virtual environment, installed JupyterLab, and opened the interface, you will learn the basics of Python using our downloadable Jupyter Notebook. The notebook contains preloaded exercises and commands to walk you through Python.
Download the Jupyter Notebook
Download: Python Tutorial Exercises
Download and save the file above into the Desktop > code > jup folder you created earlier.
Dive-in to the Python Tutorial
(jup) User-Macbook:jup user$ jupyter notebook
Windows Command Prompt
(jup) C:\Users\Owner\Desktop\code\jup>jupyter notebook
Make sure you launched the JupyterLab console with jupyter notebook from the activated virtual environment jup in the command line. The command will run and open the interface page.
Once in the JupyterLab interface, click on the newly downloaded Jupyter Notebook Python_Tutorial_Exercises.ipynb in the console to begin learning the basics of Python.
After completion, return to this page to take the quiz questions.
Close the notebook and deactivate the virtual environment
Ctrl + C
(jup)User-Macbook:jup user$ deactivate
User-Macbook:jup user$ cd ..
Ctrl + C
C:\Users\Owner\desktop\code\jup> cd ..
Once you have completed the Python Tutorial and the quiz questions below, Ctrl + C for Windows and command + C for macOS to stop the Jupyter Notebook. Then deactivate the jup virtual environment and cd .. back to the code folder so we can begin moving between projects. As a reminder, there will no longer be parentheses surrounding the virtual environment name if the environment is successfully deactivated the environment.
If you ever want to run the Python Tutorial notebook again, simply enter back into the jup folder, activate the environment and launch jupyter notebook like we did in the step, Installing Jupyter Lab.
1. Which of the following variables is a string?
"C" is correct. A string is surrounded by quotations. Although "A" is a float and "B" is an integer, they could both be turned into strings if surrounded by quotations. Once they are changed to strings, the variables cannot perform mathematical operations.
2. What value will operator(10) return given the following function?
num = x * 3
num = num + 2
"A" is correct. 10 will be multiplied by 3 and stored in the variable "num". Then 2 will be added to "num" and stored in the same variable "num" returning 32. Remember, the code on the right side of the equal sign will be read first.
3. What is the output of the following lines of code?
numbers = [2,3,4,5]
sum = 0
for i in numbers:
sum = sum + i
"B" is correct. The code snippet adds all numbers in the array together to get a total sum of 14.