0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

メモ「Automate the Boring stuff -chapter1 Python Basics」

Last updated at Posted at 2019-09-26

Data type  Examples
Integers  -2, -1, 0, 1, 2, 3, 4, 5
Floating-point numbers  -1.25, -1.0, --0.5, 0.0, 0.5, 1.0, 1.25
Strings  'a', 'aa', 'aaa', 'Hello!', '11 cats'
Operator  Operation  Example Evaluates to...

**  Exponent  2 ** 3  8

%  Modulus/remainder  22 % 8  6

//  Integer division/floored quotient  22 // 8  2

/  Division  22 / 8  2.75

*  Multiplication  3 * 5  15

-  Subtraction  5 - 2  3

+  Addition 2 + 2  4

The str(), int(), and float() Functions

>>> str(0)
'0'
>>> str(-3.14)
'-3.14'
>>> int('42')
42
>>> int('-99')
-99
>>> int(1.25)
1
>>> int(1.99)
1
>>> float('3.14')
3.14
>>> float(10)
10.0
0
0
0

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?