Python - oppsummering Lesson 2

Lærebok, kapittel 2:

Values and variables

 

kapittel 3:

Expressions and Arithmetic

Innhold i Lesson 2:

 

- Data Types: Integers, Floats, Booleans, Strings

- Operators: Arithmetic, Assignment, Comparison, Logical

- Built-In Functions, Type Conversion

- Whitespace and Style Guidelines

 

Aritmetiske operatorer: nye: %, //, **

Feilsøking - se kapittel 3.6 om Errors i læreboka

 

sf_population, sf_area = 864816, 231.89
rio_population, rio_area = 6453682, 486.5

san_francisco_pop_density = sf_population/sf_area
rio_de_janeiro_pop_density = rio_population/rio_area

# Write code that prints True if San Francisco 
# is denser than Rio, and False otherwise

print(sf_population > rio_population)