Skip to content

Instantly share code, notes, and snippets.

@HectorTorres
Last active Apr 3, 2020
Embed
What would you like to do?
#Variables de valor entero
x = 9
y = 64895
z = -325
print(x)
print(y)
#Esto te permite sumar dos variables directamente
print(y + z)
#Variables con punto decimal
x = 1.10
y = 1.0
z = -35.59
print(x)
print(y - z)
#Variables con potencias
x = 35e3
y = 12e4
z = -87.7e100
#Variables con números imaginarios
x = 5j
y = 3 + 7j
z = 9 - 5j
print(x)
print(y + z)
x = 4
y = 3.1416
z = 6 - 9j
print(type(x))
print(type(y))
print(type(z))
#Conversión de datos
x = 1 # int
y = 2.8 # float
z = 1j # complex
#convertir int a float:
a = float(x)
#convertir float a int:
b = int(y)
#convertir int a complex:
c = complex(x)
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment