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 3 years have passed since last update.

Python解説を覚え書き 3 - Numbers

Posted at

print(-2.0987) print(3 + 4.5) print(3 * (4 + 5))
# modulates operator? Modulo operator: returns the remainder of a division. print(10 % 3) # 10 divided by 3. that's going to be 3 with a remainder of 1.

# variable containers my_num = 5 print(my_num) print(str(my_num) + " is my favorite number.")

# abs == absolute value of a number my_num = -5 print(abs(my_num))

# pow print(pow(3, 2)) # 3^2 3 raised to the power of 2. It should be 3 squared.

# max, min print(max(6, 4)) print("The minimum number is " + str(min(6, 4)))

# round print(round(3.2)) print(round(3.7))

from math import * # math module gives us more math function print("floor 3.7 is " + str(floor(3.7))) print("ceil 3.7 is " + str(ceil(3.7)))

# square root print(sqrt(36))

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?