- Practical Data Wrangling
- Allan Visochek
- 348字
- 2021-07-02 15:16:08
Data types, variables, and the Python shell
In the next few sections, I will use a tool called the Python shell, which will help you get more comfortable using Python. The Python shell is a tool that allows the user to enter in Python commands, which get run instantaneously. This makes the Python shell a great place to quickly and easily experiment with small bits of code or new functionality in Python.
You can run the Python shell from a Terminal. To do this, open a Terminal and, from any directory, enter one of the following depending on your configuration:
$ Python
$ python3
You should see a new command prompt within the Terminal that looks something like this:

In Python, a single instruction is called a simple statement. For now, each individual line of code represents a simple statement. The Python shell will accept one line of code at a time. The following is an example of a simple statement that adds two numbers:
>> 1+1
Notice the >> at the beginning of our command. The >> symbol indicates that the line of code should be entered into the Python shell. The >> symbol should not be copied over with the rest of the code. You can run this statement by typing it into the shell and pressing Enter.
The Python shell will print out the result of every statement that you write. When you write the previous statement in your Python shell and press Enter, you should see the result of 2 printed just preceding it. The number 2 is an example of a value in Python. Values are like the nouns of programming languages. The + symbol is an example of an operator. Operators are like the verbs of programming languages, and they express what you would like to do with a value.
- 基于C語(yǔ)言的程序設(shè)計(jì)
- SCRATCH與機(jī)器人
- 腦動(dòng)力:C語(yǔ)言函數(shù)速查效率手冊(cè)
- PIC單片機(jī)C語(yǔ)言非常入門與視頻演練
- 計(jì)算機(jī)網(wǎng)絡(luò)應(yīng)用基礎(chǔ)
- 傳感器與物聯(lián)網(wǎng)技術(shù)
- Android游戲開(kāi)發(fā)案例與關(guān)鍵技術(shù)
- LAMP網(wǎng)站開(kāi)發(fā)黃金組合Linux+Apache+MySQL+PHP
- 筆記本電腦維修90個(gè)精選實(shí)例
- 基于敏捷開(kāi)發(fā)的數(shù)據(jù)結(jié)構(gòu)研究
- 從零開(kāi)始學(xué)Java Web開(kāi)發(fā)
- Photoshop CS5圖像處理入門、進(jìn)階與提高
- 典型Hadoop云計(jì)算
- MPC5554/5553微處理器揭秘
- Cortex-M3嵌入式處理器原理與應(yīng)用