DM536/DM550

Ex, Fri 23-10-15

Discuss how to model things in the “real world” by objects. In particular, discuss how to model the objects that are relevant for the second part of the fractal and the second part of the DNA project. Come up with possible class diagrams in small groups and discuss them with everyone. Try to learn about design choices by comparing the differences in them

Lab, Mon 19-10-15

You can pick up your printed assignments at this class or in my letter box afterwards. They will remain there until the next assignment is due.

Exercises:

Ex, Fri 09-10-15

We will discuss some of these exercises:

Then do:

Lab, Mon 05-10-15

For the assignment:

Place a printed version in my letter box at IMADA just outside the Vector room.

Remember, even though something doesn’t quite work in your implementation, don’t lose hope. Hand it in anyway and make sure to document what doesn’t work.

Exercises:

Lab, Mon 28-09-15

Exercises:

Ex, Fri 25-09-15

Project status

  1. Not started yet
  2. Started but stuck
  3. Started and progressing nicely
  4. Finished

Exercises:

Lab, Mon 21-09-15

Exercises:

Lab, Mon 14-09-15

Exercises:

Some solutions: 5.3, 5.4, 5.6, 7.2.

Ex, Fri 11-09-15

Exercises:

1
2
3
4
5
def print_n(s, n):
    if n <= 0:
        return
    print s
    print_n(s, n-1)

Some solutions: 6.3, 6.7.

Recursion: A function that calls itself.

Fibonacci:

Nature:

Recursive tree

Sierpinski triangle:

Sierpinski triangle

Koch snowflake:

Koch snowflake

Lab, Mon 07-09-15

If you haven’t already, go ahead and do the tutorial from Lab, Thu 03-09-15.

Exercises:

Then, exercise from weekly note:

Write a small program that interacts with the user by e.g. asking for the user’s name, then welcoming the user etc. Use your creativity to create an interesting dialogue. Look up the functions raw_input() and input() in the library reference to handle user input

Now it gets interesting! First, install swampy. Go to the bottom of this page to find a guide.

Some solutions: 3.3.

Don’t forget that there are TurtleWorld related solutions here and here.

Lab, Thu 03-09-15

Peter wants you to take a look at the Python documentation. Note that we are using Python 2.7 and not 3.

Specifically, you should glance through:

and

Next, launch Python and start working on the Python tutorial.

Installing Python, pip and swampy

First, we install Python and pip.

Windows and Mac OSX:

Go to python.org. In the menubar, hover your mouse over “Downloads” and choose “Python 2.7.10”. Install as normally. pip will also be installed.

Linux (Ubuntu):

Open a terminal and write

sudo apt-get install python python-pip

Next, install swampy using pip.

Windows:

Open Command Prompt by searching for cmd in the Windows search menu. In cmd type.

cd C:\Python27\Scripts

You are now in the correct folder to execute pip.

All platforms:

Open a terminal/cmd if you haven’t already and write

pip install swampy

If using Linux (and possibly Mac OSX) and the above command downloads something, but then fails, try

sudo pip install swampy

You will be prompted for your password.