Introducción a Python

Operadores

The Python interpreter can be used to evaluate expressions, for example simple arithmetic expressions. If you enter such expressions at the prompt (>>>) they will be evaluated and the result will be returned on the next line.


In [ ]:
1+1

In [ ]:
1 and 1

Cadenas de texto

The Python interpreter can be used to evaluate expressions, for example simple arithmetic expressions. If you enter such expressions at the prompt (>>>) they will be evaluated and the result will be returned on the next line.


In [ ]:
'artificial' + "intelligence"

In [ ]:
'artificial'.upper()

In [ ]:
s='hello world'
len(s.upper())

In [ ]:
help(s.find)

Estructuras complejas

Listas


In [ ]:
fruits = ['apple','orange','pear','banana']
fruits[0]

In [ ]:
otherFruits = ['kiwi','strawberry']
fruits+otherFruits

In [ ]:
fruits[0:2]

In [ ]:
fruits[:3]

In [ ]:
fruits[2:]

In [ ]:
len(fruits)

In [ ]:


In [ ]: