User:Jarle Pahr/INF1100: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Notes from INF1100 course at UiO:
Notes from INF1100 course at UiO:
http://www.uio.no/studier/emner/matnat/ifi/INF1100/h13/timeplan/index.html#FOR
Faksimile av kapitler 1 + 2:
http://heim.ifi.uio.no/~inf1100/INF1100_book_ch1-2.pdf
=Oppgaver=
Prosjektoppgaver, løp 2:
http://heim.ifi.uio.no/~inf1100/projects.html
Faksimile av oppgaver:
http://heim.ifi.uio.no/~inf1100/INF1100_exercises_3rd_ed.pdf




Line 14: Line 33:
Conditional value assignment:
Conditional value assignment:
*variable = (value1 if condition else value2)
*variable = (value1 if condition else value2)
Zip:
See http://docs.python.org/3/library/functions.html?highlight=zip#zip
Example:
h = 0.02
x = [i*h for i in range(0,101,1)]
for x_i in x:
y.append(math.asin(x_i)
for x_i, y_i in zip(x,y):
print "%.3f %.3f" % (x_i,y_i)

Latest revision as of 12:52, 12 September 2013

Notes from INF1100 course at UiO:


http://www.uio.no/studier/emner/matnat/ifi/INF1100/h13/timeplan/index.html#FOR


Faksimile av kapitler 1 + 2: http://heim.ifi.uio.no/~inf1100/INF1100_book_ch1-2.pdf

Oppgaver

Prosjektoppgaver, løp 2:


http://heim.ifi.uio.no/~inf1100/projects.html

Faksimile av oppgaver: http://heim.ifi.uio.no/~inf1100/INF1100_exercises_3rd_ed.pdf


Chapter 3

Keyword arguments:

  • If both positional and keyword arguments are used, positional arguments must appear before keyword arguments.
  • If a function uses only keyword arguments, the argument input order is arbitrary.


Conditional value assignment:

  • variable = (value1 if condition else value2)


Zip:

See http://docs.python.org/3/library/functions.html?highlight=zip#zip

Example:

h = 0.02
x = [i*h for i in range(0,101,1)]
for x_i in x:

y.append(math.asin(x_i)

for x_i, y_i in zip(x,y):

print "%.3f %.3f" % (x_i,y_i)