Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

functions

  • Loading branch information...
commit 7e35771b70f26a607453f90d829d97609ca6d629 1 parent 835ff42
Robert authored January 17, 2012
11  src/05_dictionary.py
@@ -3,12 +3,7 @@
3 3
 
4 4
 @author: robert
5 5
 '''
6  
-student1 = {'lname':'Stiernet','fname':'Gino'}
7  
-student2 = {'lname':'Lau','fname':'Philip'}
  6
+student = {'lname':'Stiernet','fname':'Gino','age':21}
8 7
 
9  
-
10  
-students = (student1,student2)
11  
-print students
12  
-
13  
-for x in students:
14  
-    print x["lname"],x["fname"]
  8
+print student
  9
+print student['lname'],student['age']
12  src/08_for_while_loops.py
@@ -25,4 +25,14 @@
25 25
     
26 26
 age={'Jesse':21,'Raf':23,'Niels':22}
27 27
 for student in age:
28  
-    print student,age[student]
  28
+    print student,age[student]
  29
+
  30
+# 
  31
+    
  32
+student1 = {'lname':'Stiernet','fname':'Gino'}
  33
+student2 = {'lname':'Lau','fname':'Philip'}
  34
+students = (student1,student2)
  35
+print students
  36
+
  37
+for x in students:
  38
+    print x["lname"],x["fname"]    
37  src/09_functions.py
... ...
@@ -0,0 +1,37 @@
  1
+'''
  2
+Created on Jan 17, 2012
  3
+
  4
+@author: robert
  5
+'''
  6
+def student(naam):
  7
+    return 'hallo ' + naam
  8
+
  9
+print student('Raf')
  10
+
  11
+def group (naam,vnaam,groep='PC1'):
  12
+    return '%s %s volgt de opleiding %s' % (naam,vnaam,groep)
  13
+
  14
+print group ('Raf','Van Haver')
  15
+print group ('Raf','Van Haver','PC2')
  16
+
  17
+def rapport (naam,vnaam,*punten):
  18
+    print naam,vnaam
  19
+    print punten
  20
+    print 'gem. ',sum(punten)/len(punten)
  21
+    
  22
+rapport ('Raf','Van Haver',68,34,92,34)
  23
+
  24
+def vakken (naam,vnaam,**vak):
  25
+    print naam,vnaam
  26
+    print vak
  27
+    
  28
+vakken ('Raf','Van Haver',Nederlands=56,Engels=95,Godsdienst=23)
  29
+
  30
+vakpunten = {'Wiskunde':68,'Frans':34,'Technologie':92}
  31
+
  32
+vakken ('Raf','Van Haver',**vakpunten)
  33
+
  34
+
  35
+
  36
+
  37
+    

0 notes on commit 7e35771

Please sign in to comment.
Something went wrong with that request. Please try again.