Skip to content

Instantly share code, notes, and snippets.

@HectorTorres
Last active April 3, 2020 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HectorTorres/347ce95499ee0744681ecf4759357f6f to your computer and use it in GitHub Desktop.
Save HectorTorres/347ce95499ee0744681ecf4759357f6f to your computer and use it in GitHub Desktop.
#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