Notizen
Ohne Titel
Inhalt der Notizen (1)
Seite 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
Informationen
- Beschreibung
- Python Notiz am Ohne Titel, erstellt von Manogna Oruganti am 27/02/2019.
- Erstellt von
- Manogna Oruganti
- Aufrufe
- 1
- Bewertung