Python : Uso de funciones matemáticas en Python

NC > Computación > Python

# Python 2.7

n = abs(-4)
print n
n = abs(-5.2)
print n
n = oct(15)
print n
n = hex(15)
print n
n = max(56, 3)
print n
n = pow(2, 3)
print n
4
5.2
017
0xf
56
8

import math
# Python 2.7
import math
n = math.sin(0)
print n
n = math.pi
print n
n = math.degrees(3.141592)
print n
n = math.radians(180)
print n
n = math.cos(math.pi/3)
print n
n = math.cos(math.radians(60))
print n
0.0
3.14159265359
179.999962552
3.14159265359
0.5
0.5

Links

  1. https://docs.python.org/2.7/reference/
0.03

No hay comentarios.:

Publicar un comentario