¡GoConqr estrena diseño! Cuéntanos qué te parece.

Apuntes

Sin título

Manogna Oruganti Python Inglés 1 página

Contenido del apunte (1)

Página 1

Type conversion

type(varible) gives the type name

you cannot simply sum strings and floats,/int/etc in print statement. Hence convert them into string by using function str.

Similar functions such as int(), float() and bool() will help you convert Python values into any type.

lists, list of lists, subsetting lists, indexing list from back

[ : ] includeive:exclusive

Removing elements from the list is done by using function del()

Ex: del(x[1])

When you copy list to other variable, you copy the reference.

ADD

# Create list areas

areas = [11.25, 18.0, 20.0, 10.75, 9.50]

# Create areas_copy

areas_copy = list(areas)

#or areas_copy = areas[:]

# Change areas_copy

areas_copy[0] = 5.0

# Print areas

print(areas)

fam = ["mom","dad]

Functions => fun()

type(fam)

> list

Methods:: call functions on object

ex:

fam.index("dad")

> 1

In python, everything is an object and it has methods depending on type

Información

Descripción
Python Apunte sobre Sin título, creado por Manogna Oruganti el 27/02/2019.
Visitas
1
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?