We chose Python for learning computer programming

Most universities buy an introductory programming course from their computer science department. Very often the offer is a standard Java course. Exceptionally the choice is C, C++, or perhaps something more exotic like Scheme. The primary examples are frequently math-free toy problems ("class Dog is a subclass of class Animal, and class Dog has four instances of class Leg"). Our experience is that the combination of programming and mathematical application is challenging and requires much training. Without such training, the students must usually relearn to program when they meet a need for programming in science courses with languages like MATLAB, Fortran, C, or C++.

At the University of Oslo, the introductory Java course was free of any mathematics and not synchronized with the needs in later science courses. The mentioned relearning of programming consumed much time when they met a totally different language and totally different applications of programming at the end of the bachelor studies. We therefore decided around 2006 to develop an introductory programming course that could lay a firm foundation for continued programming in all later courses that could benefit from integrating numerical simulations. We would therefore teach programming in the context of relevant algorithms like numerical integration, differentiation, solution of differential equations, and Monte Carlo simulation.

The introductory programming course was scheduled for the very first semester, meaning that the students would learn to program and use the computer to solve mathematical problems from day one. But what should be the language of choice? MATLAB or C++ were obvious candidates because of their popularity. These two languages are, however, very different in nature, and it is not natural to integrate them in a course. Python, on the other hand, can be used for MATLAB-style programming and object-oriented or generative C++-style programming. In this way Python provides a natural glue between different programming styles. We also knew that Python was much easier to use and teach than C++. The most convincing argument was, nevertheless, that Python may act as a MATLAB replacement for students and professors, doing the same things as MATLAB, and for free, but with a much more powerful programming language at disposal.

Again I wrote a book for the introductory programming course, this time addressing newcomers to programming and concentrating the examples on numerical computing. Needless to say, there were many skeptics: Python was of marginal interest to scientific computing, Python was a bad first language because of its dynamic typing, mixing programming and mathematics is inferior to first mastering calculus and Java separately - and the arguments went on and on to avoid radical changes.

The course is now a huge success, and the book is a best-seller in its category. Since 2007, more than 1500 students have passed the exam and used the programming technology to solve mathematical problems in about 20 other courses in the Bachelor programs at the University of Oslo. The introduction of programming and numerical simulation in all these other courses was a huge undertaking known as the Computing in Science Education project. This project has attracted worldwide attention as it represents a long-awaited reform of the science education. The idea is trivial: let programming and computer simulations change the curriculum! However, the implementation among professors is extremely demanding most places. The fortunate situation in Oslo is that professors across disciplines have managed to collaborate on how programming and simulation can be integrated in classical courses and used to replace the classical strong attention on complicated and specialized mathematical techniques for very simplified physical problems. Recently, the Computing in Science Education project has been acknowledged by the University and the government in Norway through prestigious awards and generous funding. The ideas are being implemented at other Norwegian colleges and universities as well as at several institutions abroad.