Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
suzanbones committed Oct 2, 2023
2 parents 391f597 + 6509cbe commit 807c46d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 194 deletions.
3 changes: 2 additions & 1 deletion _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ parts:
- file: lectures/4_turtle_recursie
- file: course/practical_4
sections:
- file: practicals/4_recursie_unplugged
- file: practicals/4_turtle
- file: practicals/4_recursie_unplugged
- file: practicals/4_midterm
- file: course/opstap_4
sections:
- file: problems/instap/4_turtle
Expand Down
193 changes: 0 additions & 193 deletions practicals/4_midterm.ipynb

This file was deleted.

81 changes: 81 additions & 0 deletions practicals/4_midterm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Reading code

## Opdracht 1

Welke error geeft onderstaande code?

```python
def function(x):

print(x[0])

if len(x) == 0:
return

function(x[:-1])

function("Hanze")
```

## Opdracht 2

Wat is de output van onderstaande programma?

```python
def function(x):
if len(x) == 0:
return
function(x[:-1])
print(x[-1])

function("Hanze")
```

## Opdracht 3

Gegeven de volgende regels aan code

```{code-block} python
---
linenos: True
---
def function(x,y,z):
if y == z:
return
function(x, y+1, z)
function("x", 2, 5)
```

Welke print statement moet er op regel 4 komen om de volgende output te generen?

```ipython
xxxx
xxxxxx
xxxxxxxx
```

## Opdracht 4

Wat is de output van onderstaande programma?

```python
def main():
x = [1,7,3,8,9,5]
function(x)
print(x)

def function(x):
if len(x) <= 1:
return
x[0] = function2(x[0], x[1])
function(x[1:])

def function2(x, y):
if x < y:
return x
return y

main()
```

0 comments on commit 807c46d

Please sign in to comment.