lab00.py - \/usr\/bin\/env python coding utf-8 Lab 0 Introduction and Practice with Jupyter Notebooks In Lab 0 you will learn how to navigate a Jupyter

lab00.py - /usr/bin/env python coding utf-8 Lab 0...

This preview shows page 1 - 3 out of 8 pages.

#!/usr/bin/env python # coding: utf-8 # # Lab 0: Introduction and Practice with Jupyter Notebooks # In Lab 0, you will learn how to navigate a Jupyter Notebook (like this one). All of the required lab assignments in this course are published as jupyter notebooks. You follow the instructions in the notebook to complete the assignment. # # This one isn't graded, but you should complete it anyway for practice. Let's get started! # ## 1. Jupyter notebooks # This webpage is called a Jupyter notebook. A notebook is a place to write programs and view their results. # # ### 1.1. Text cells # In a notebook, each rectangle containing text or code is called a *cell*. # # Text cells (like this one) can be edited by double-clicking on them. They're written in a simple format called [Markdown] () to add formatting and section headings. You don't need to learn Markdown, but you might want to. # # After you edit a text cell, select the "run cell" button at the top that looks like | to confirm any changes. # **Question 1.1.1.** <br /> # This paragraph is in its own text cell. Try editing it so that **this** sentence is the last sentence in the paragraph, and then select the "run cell" | button on the top. This sentence, for example, should be deleted. So should this one. # In[6]: print("LOVE DATA SCIENCE") # And this one: # In[7]: print("\N{WAVING HAND SIGN}, \N{EARTH GLOBE ASIA-AUSTRALIA}!") # The fundamental building block of Python code is an expression. Cells can contain multiple lines with multiple expressions. When you run a cell, the lines of code are executed in the order in which they appear. Every `print` expression prints a line. Run the next cell and notice the order of the output. # In[8]: print("First this line is printed,") print("and then this one.") # **Question 1.2.1.** <br /> # Change the cell above so that it prints out: # # First this line,
Image of page 1
# then the whole ?, # and then this one. # # *Hint:* If you're stuck on how to print the Earth symbol, try looking at the print expressions above. # In[12]: print("First this line, \nthen the whole \N{EARTH GLOBE ASIA-AUSTRALIA},\nand then this one.") # ### 1.3. Writing Jupyter notebooks # You can use Jupyter notebooks for your own projects or documents. They are among the world's most popular programming environments for data science. When you make your own notebook, you'll need to create your own cells for text and code. # # To add a cell, select the + button in the menu bar. A new cell starts out as text. You can change it to a code cell by selecting it so that it's highlighted, then selecting the drop-down box next to the restart (?) button in the menu bar, and choosing Code instead of Markdown. # # **Question 1.3.1.** <br /> # Add a code cell below this one. Write code in it that prints out: # # A whole new cell! # ♪?♪ # # (That musical note symbol is like the Earth symbol. Its long-form name is `\N{EIGHTH NOTE}`.) # # Run your cell to verify that it works.
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 8 pages?

  • Fall '17
  • DNA, Cell type, jupyter notebooks

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes