Skip to Main Content
Hands-On Application Development with PyCharm
book

Hands-On Application Development with PyCharm

by Quan Nguyen
September 2019
Beginner to intermediate content levelBeginner to intermediate
494 pages
13h
English
Packt Publishing
Content preview from Hands-On Application Development with PyCharm

Implementing PyCharm code cells

Code cells in PyCharm are defined by lines of code that start with the following characters: #%%. These lines are treated as standard comments in the low-level execution of Python, but PyCharm will recognize them as code cell separators in its editor. Let's see this feature in action:

  1. In our current program, add those lines so that your program is similar to the following:
import numpy as npimport matplotlib.pyplot as plt#%% generate random dataN = 100x = np.random.normal(0, 1, N)y = np.random.normal(2, 3, N)#%% plot data in histogramsplt.hist(x, alpha=0.5, label='x')plt.hist(y, alpha=0.5, label='y')plt.legend(loc='upper right')plt.show()

As you can see, we can actually put comments in these code cell separators, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MASTERING PYCHARM

MASTERING PYCHARM

Nafiul Islam

Publisher Resources

ISBN: 9781789348262Supplemental Content