Introduktion till Python
Hugo Bowne-Anderson
Data Scientist at DataCamp
float - reella tal
int - heltal
str - sträng, text
bool - True, False
height = 1.73
tall = True
Data Science: många datapunkter
Hela familjens längd
height1 = 1.73
height2 = 1.68
height3 = 1.71
height4 = 1.89
[a, b, c][1.73, 1.68, 1.71, 1.89]
[1.73, 1.68, 1.71, 1.89]
fam = [1.73, 1.68, 1.71, 1.89]
fam
[1.73, 1.68, 1.71, 1.89]
Namnge en samling värden
Kan innehålla vilken typ som helst
Kan blanda olika typer
[a, b, c]fam = ["liz", 1.73, "emma", 1.68, "mom", 1.71, "dad", 1.89]fam
['liz', 1.73, 'emma', 1.68, 'mom', 1.71, 'dad', 1.89]
fam2 = [["liz", 1.73], ["emma", 1.68], ["mom", 1.71], ["dad", 1.89]]fam2
[['liz', 1.73], ['emma', 1.68], ['mom', 1.71], ['dad', 1.89]]
type(fam)
list
type(fam2)
list
Specifik funktionalitet
Specifikt beteende
Introduktion till Python