Tag: ジュピター

  • I Don’t Really Know Much, But I Want to Program in Python! (1)

    I Don’t Really Know Much, But I Want to Program in Python! (1)

    When you start learning programming, I think the first hurdle is figuring out where to begin.
    You search online, but then what? What software are you even supposed to use to write your code?

    I struggled with exactly that myself.

    Broadly speaking, there are two kinds of tools for writing programs.
    One is interactive, and the other is script-based. (I’m putting it this way for clarity. I’m not entirely sure it’s the correct terminology, though…)

    With the interactive type, you type one line and get one response back
    —you write and run the program one line at a time, over and over.

    With the script type, it’s like writing a whole essay and then getting feedback on it
    —you run the entire program at once.
    This script type is what most people picture when they think of programming: page after page of cryptic-looking code.

    The problem is, when you set out to write a script-type program, what software should you actually use?

    On top of that, beginner-level programming lessons often use the interactive style, but at the intermediate level you’re suddenly writing script code, and what to write it in is either left unstated or differs completely from book to book.

    For the interactive style, you use something already built into your computer, like Command Prompt or Terminal, and get started by typing “Python”.

    But what do you write script-type programs in?

    Most script-type programs are written in an IDE (integrated development environment). (When in doubt, searching “Python IDE recommended” will turn up plenty of articles.)

    The tools I normally use for writing script-type programs are
    Jupyter Notebook and PyCharm.
    (Apparently people are split on whether “Jupyter” is pronounced “joo-pih-ter” or “joo-py-ter”.)

    I use Jupyter Notebook for statistical analysis and plotting graphs, and PyCharm for driving hardware or writing more complex programs.

    Let me describe what each one is like.

    First, Jupyter Notebook.
    It comes bundled when you download Anaconda.
    When you launch Jupyter Notebook, a browser such as Safari or Firefox opens first.

    A list of the files on your computer is then displayed.
    Open the folder you want, and click “New” in the upper right.
    Then click “Python 3” and a screen like the image below will open.
    Saving this file gives you a *.ipynb file.

    You write your code in individual cells, and by clicking the RUN button at the top you can execute the program cell by cell.

    Being able to run code one cell at a time is a huge advantage when making graphs or doing statistics.
    That’s why I use it so often.

    I use PyCharm when opening *.py files.
    Note that the two tools open different file types, so be careful.

    For PyCharm, please refer to other sites.
    (I haven’t used it much yet, so I plan to cover how to use it in detail in a future post.)

    The Anaconda site is here

    The Jupyter Notebook site is here

    The PyCharm site is here
    For the download, choose the gray Community edition rather than Professional—that’s the free one.
    I’d recommend starting with that.

    I’ve been using Jupyter Notebook a lot lately, so I plan to keep posting updates, both as notes on my own learning and for anyone who wants to learn to program.