LoginSignup
0
0

More than 1 year has passed since last update.

python初学者の備忘録 数値型について

Last updated at Posted at 2021-09-13

←目次へ

python,Qiita初心者なので、備忘録として記載していきます。 なにせ初心者なので、知識不足はご理解ください。 知識を深めながら追記していきたいと思います。

数値型とは

基本

  • int型(整数)
  • float型(浮動小数点数)
  • complex型(虚数)

虚数、複素数については別項で行います。

  • 以下の演算子を使うことが可能

python初学者の備忘録 代数演算子について →

数値の演算
>>> 5 + 3
8

>>> 5 - 3
2

>>> 5 * 3
15

>>> 5 / 3
1.66666666666666667

>>> 5 % 3
2

>>> 5 ** 3 # 5 * 5 * 5と同様
125

>>> 5 // 3
1
int型とfloat型の計算
>>> 5 + 3.0
8.0

>>> 5 - 3.0
2.0

int型とfloat型で計算した場合float型になる

数値型で使用する関数 →

0
0
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0