‘Python vs Java?’ is a question we get asked by students a lot. Here are our thoughts. Python, a programming language named not after a snake species but a 1970s British television comedy sketch, is gaining popularity in colleges across the US. In a recent article, ComputerWorld reported that  “Python has surpassed Java as the top language used to introduce U.S. students to programming.” The article goes on to suggest that majority of top computer science departments in the US now use Python to teach coding.

Programming Languages Java Python HTML

As a teacher who has introduced programming to thousands of students, I must say that I am thrilled with this development. Consider the following program in Java. It prints out the text “Hello World” on the screen and is generally the first example used by many programming instructors.

Hello World In Java

class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello World");
   }
}

Now imagine you are a novice programmer looking at this program. You would probably have many questions, including: What is a class? What does the word public mean? What is static? What is main? Why does learning have to be so tough?

One way I have seen many teachers handle this barrage of questions is by telling the student to simply “trust them.” This response, as I suspect you will agree, is just not satisfactory.

Next, let’s look at the same program in Python.

Hello World In Python

print “Hello World”

It’s one line of code and is pretty close to English. This lets the learner focus more on the program they are designing and not get riled up in tricky syntax and keywords.

In one of our new courses, Programming Foundations with Python, we leverage the simplicity of Python to teach important computing ideas like Object Oriented Programming. In Intro to Computer Science, Udacity’s most popular introductory programming course, we also introduce students to programming with Python. Thousands of students have taken these courses and are responding positively to Python.

 

Miguel, a student in Programming Foundations with Python, posts his feelings on the discussion forum by saying, “I’m quite impressed with how easy it’s been to utilize Python for interesting tasks.” Christine, another student in the class, says that she, “explained to [her] husband how [her] program works … and he was impressed that python can achieve such results with so few lines.”


As a teacher, I welcome the use of Python in introductory classes. But I am also convinced that Python will eventually be replaced with a new language of choice — in much the same way that Python replaced Java, which previously replaced Pascal. I tell my students that the one thing they can be sure of is that they will be learning new programming languages throughout their career.

This brings to fore the idea that we all really need to learn how to learn new things. This sounds like it could be a new course at Udacity. Who’s with me?

Kunal Chawla, Instructor, Programming Foundations with Python