Introduction to Python
Hugo Bowne-Anderson
Data Scientist at DataCamp
Nothing new!
type()
Piece of reusable code
Solves particular task
Call function instead of writing code yourself
fam = [1.73, 1.68, 1.71, 1.89]
fam
[1.73, 1.68, 1.71, 1.89]
max(fam)
1.89
fam = [1.73, 1.68, 1.71, 1.89]
fam
[1.73, 1.68, 1.71, 1.89]
max(fam)
1.89
fam = [1.73, 1.68, 1.71, 1.89]
fam
[1.73, 1.68, 1.71, 1.89]
max(fam)
1.89
fam = [1.73, 1.68, 1.71, 1.89]
fam
[1.73, 1.68, 1.71, 1.89]
max(fam)
1.89
tallest = max(fam)
tallest
1.89
round(1.68, 1)
1.7
round(1.68)
2
help(round) # Open up documentation
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
help(round)
Help on built-in function round in module builtins:
round(number, ndigits=None)
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None.
Otherwise the return value has the same type as the number. ndigits may be negative.
round(number)
round(number, ndigits)
How to know?
Standard task -> probably function exists!
The internet is your friend
Introduction to Python