- Practical Data Wrangling
- Allan Visochek
- 344字
- 2021-07-02 15:16:08
Why integers?
It may seem peculiar at first to distinguish between int and float as fundamentally different data types. The first reason to make the distinction is that computers store these numbers differently and, for the sake of computer programming, there are a couple of scenarios in which it makes more sense for a programming language to use one or the other. For example, as we will see later in this chapter, using a float to index an array will cause an error and thus prevent the program from running.
You can add, divide, and multiply in a single statement, using the same rules you would expect in a scientific calculator. The order of operations is as follows:
- Expressions inside parentheses.
- Exponents.
- Division.
- Multiplication.
- Addition and subtraction.
The following commands are some examples of arithmetic in Python:
>> 2 * 3
>> 4 + 5 / 6
>> (4 + 5) / 6
>> ( ( 1 * 2 ) / 3 / 4 ) + 5 - (6 / 5)
Exponents in Python are denoted using two consecutive multiplication ** symbols. Careful not to use the ^ symbol for exponentiation in Python. The following is an example of arithmetic in python:
>> 3 ** 2
- 大數(shù)據(jù)導(dǎo)論:思維、技術(shù)與應(yīng)用
- Mastering Spark for Data Science
- PostgreSQL 11 Server Side Programming Quick Start Guide
- 并行數(shù)據(jù)挖掘及性能優(yōu)化:關(guān)聯(lián)規(guī)則與數(shù)據(jù)相關(guān)性分析
- WOW!Illustrator CS6完全自學(xué)寶典
- 離散事件系統(tǒng)建模與仿真
- Mastering Machine Learning Algorithms
- 永磁同步電動(dòng)機(jī)變頻調(diào)速系統(tǒng)及其控制(第2版)
- DevOps:Continuous Delivery,Integration,and Deployment with DevOps
- Hybrid Cloud for Architects
- PostgreSQL 10 Administration Cookbook
- LAMP網(wǎng)站開(kāi)發(fā)黃金組合Linux+Apache+MySQL+PHP
- 軟件構(gòu)件技術(shù)
- Mastering Ceph
- 數(shù)字多媒體技術(shù)基礎(chǔ)