Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!

# Basic Operators

esta sección explica un poco sobre como usar los operadores básicos en Python.

Tal como cualquierr otro lenguaje de programacion, los operadores de sumas, restas, multiplicaciones y divisiones pueden ser usadas con números.

numeros = 1 + 2 * 3 / 4.0

Intenta predecir que la respuesta será. Si python sigue las ordenes de los operadores?

Otro operador disponible es el de modulo (%), este regresa el integral remanente de una división. dividendo % divisor = remanente.

remanente = 11 % 3

Usando dos simbolos de multiplicación crea una relación de potencia.

cubico = 2 ** 3

holamundo = "hola" + " " + "mundo"

Python también soporta multiplicar texto o cadenas para formar una cadena con una secuencia repetitiva:

muchosholas = "hola" * 10

even_numbers = [2,4,6,8]
odd_numbers = [1,3,5,7]
all_numbers = odd_numbers + even_numbers

Just as in strings, Python supports forming new lists with a repeating sequence using the multiplication operator:

print [1,2,3] * 3

### Ejercicios

The target of this exercise is to create two lists called x_list and y_list, which contain 10 instances of the variables x and y, respectively. You are also required to create a list called "big_list", which contains the variables "x" and "y", 10 times each, by concatenating the two lists you have created.

This site generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!