Memorize Python commentary 3 --Numbers

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))

Recommended Posts

Memorize Python commentary 3 --Numbers
Memorize Python commentary 5 --Lists
Memorize Python commentary 4 --Input
Memorize Python commentary 2 --Strings
Memorize the Python commentary on YouTube.
Prime numbers in Python
[Python] Obtaining American-style week numbers
Determine prime numbers with python
Python OCR recognizes single-letter numbers
Separate numbers by 3 digits (python)
Handle complex numbers in Python
Playing handwritten numbers with python Part 1
Testing with random numbers in Python
Python
[Python] Convert natural numbers to ordinal numbers
ABC128 A, B, C commentary (python)
Convert decimal numbers to n-ary numbers [python]
Law of large numbers in python
[Python] nCr mod Compute prime numbers
[Python] Change the alphabet to numbers
Python numbers, strings, list types (Python learning memo ①)
Play handwritten numbers with python Part 2 (identify)
[Python] How to display random numbers (random module)
Algorithm learned with Python 4th: Prime numbers
I searched for prime numbers in python
Python> Output numbers from 1 to 100, 501 to 600> For csv
Project Euler # 2 "Even Fibonacci Numbers" in Python
Python commentary whose parents were killed literally